Is there any sample code around showing how to use pdb-set-error-handler and pdb-get-error-handler to detect and do something alternate to just failing with an error dialog? All I can Google is a suggestion from Sven to use these to intercept errors--a good idea--but no examples on how to do that.
My script-fu is occasionally/rarely getting the message "Error: invalid type for argument 1 to gimp-context-set-foreground or gimp-context-set-background. These functions only have one argument, a color. So somehow it is occasionally dropping the color. The weird part is that if I re-run the script-fu using the same options, I don't get the error. It's like Script-Fu hiccupped or something. So I'd like to capture what the value of the item was when I got the error, say to capture it and print it out.
At the very least I'd like to avoid leaving a stray selection.
But I don't even know how to start. Any pointers?
Or would I be better off with throw and catch?