Quantcast

MAElementMorphs Hide Errors

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

MAElementMorphs Hide Errors

Sean P. DeNigris
Administrator
What do you think of the following error handling? If an error is encountered converting a string to the underlying domain object, it silently passes the raw string back to the model. This led to a very difficult to trace bug in my code. Is there a valid reason to hide the error that makes it worth the confusion?

MAElementMorph>>#string: aString
        | value |
        value := [ self magritteDescription fromString: aString greaseString ]
                on: Error do: [ :e | aString ].
        self value: value; changed: #string
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MAElementMorphs Hide Errors

DiegoLont
Hi Sean,

Now that I take a good look at this code, I can see of a valid reason to hide the error. I am not sure, but I think that on each keystroke, this method is called. When the user did not put in something valid yet, you do want to store the value, but do not want to convert it yet.

Regards,
Diego

On 21 Apr 2015, at 17:05, Sean P. DeNigris <[hidden email]> wrote:

> What do you think of the following error handling? If an error is encountered
> converting a string to the underlying domain object, it silently passes the
> raw string back to the model. This led to a very difficult to trace bug in
> my code. Is there a valid reason to hide the error that makes it worth the
> confusion?
>
> MAElementMorph>>#string: aString
> | value |
> value := [ self magritteDescription fromString: aString greaseString ]
> on: Error do: [ :e | aString ].
> self value: value; changed: #string
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/MAElementMorphs-Hide-Errors-tp4820869.html
> Sent from the Magritte, Pier and Related Tools mailing list archive at Nabble.com.
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Loading...