Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readable DimensionError message #62

Merged
merged 11 commits into from
Mar 24, 2017

Conversation

ggggggggg
Copy link
Contributor

It's hard to read the types of long units, so I put a more readable message in for DimensionError. With this PR

julia> 1u"m"+1u"s"
ERROR: DimensionError: 1 m and 1 s are not dimensionally compatible.
 in +(::Unitful.Quantity{Int64,Unitful.Dimensions{(Unitful.Dimension{:Length}(1//1),)},Unitful.Units{(Unitful.Unit{:Meter,Unitful.Dimensions{(Unitful.Dimension{:Length}(1//1),)}}(0,1//1),),Unitful.Dimensions{(Unitful.Dimension{:Length}(1//1),)}}}, ::Unitful.Quantity{Int64,Unitful.Dimensions{(Unitful.Dimension{:Time}(1//1),)},Unitful.Units{(Unitful.Unit{:Second,Unitful.Dimensions{(Unitful.Dimension{:Time}(1//1),)}}(0,1//1),),Unitful.Dimensions{(Unitful.Dimension{:Time}(1//1),)}}}) at /Users/oneilg/.julia/v0.5/Unitful/src/Unitful.jl:412

I'd suggest a reading over Conversion.jl and Promotion.jl fairly close, as I had few decisions about what to do with ::Type arguments, and you may prefer something else.

@ajkeller34
Copy link
Collaborator

Looks good, thanks! I made some small changes and will merge this after CI passes.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 67.91% when pulling 1dac617 on ggggggggg:pull-request/77313054 into b39ac60 on ajkeller34:master.

@ajkeller34 ajkeller34 merged commit e7e67e9 into PainterQubits:master Mar 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants