Update 'Error Handling'
parent
f22fdf4914
commit
3406ebd413
@ -6,3 +6,23 @@ When an error bubbles up to the actual program that is driving the compilation c
|
|||||||
|
|
||||||
# Error Messages
|
# Error Messages
|
||||||
When writing error messages, present the user with something very plain. Do not overload the message with technichal information. Describe what the problem is, and why it was reported. In terms of descriptiveness, be the opposite of the Go compiler. In terms of clarity, be the opposite of g++.
|
When writing error messages, present the user with something very plain. Do not overload the message with technichal information. Describe what the problem is, and why it was reported. In terms of descriptiveness, be the opposite of the Go compiler. In terms of clarity, be the opposite of g++.
|
||||||
|
|
||||||
|
For example, say you wanted to produce an error when a value of one type can't be passed as another type. You could do:
|
||||||
|
|
||||||
|
```
|
||||||
|
type mismatch of String:1 (aka {U32 ..}:1), U64:1
|
||||||
|
```
|
||||||
|
|
||||||
|
... Which is messy, and overly long for something that isn't conceptually dense at all. You could try:
|
||||||
|
|
||||||
|
```
|
||||||
|
mismatch String:1 U64:1
|
||||||
|
```
|
||||||
|
|
||||||
|
... Which is overly terse and does not properly convey its meaning.
|
||||||
|
|
||||||
|
This, however, is ideal:
|
||||||
|
|
||||||
|
```
|
||||||
|
U64:1 cannot be used as String:1
|
||||||
|
```
|
Reference in New Issue
Block a user