Hello Racketeers, I have been trying to port a module over to Typed Racket, and I have almost succeeded except for one issue: raising an arbitrary object as an error. Compare the following code:
;; Works fine (raise 3) ;; Does not work (raise (vector 1 2 3)) The error I get is ; nvim-client/client.rkt:244:55: Type Checker: No function domains matched in ; function application: ; Domains: (U (Rec flat (U (Pairof flat flat) Boolean Char Complex Keyword Null ; String Symbol)) exn) Any ; (U (Rec flat (U (Pairof flat flat) Boolean Char Complex Keyword Null ; String Symbol)) exn) ; Arguments: (U (Immutable-HashTable Packable Packable) (Mutable-HashTable ; Packable Packable) (Pairof Packable (Listof Packable)) (Weak-HashTable ; Packable Packable) Boolean Bytes Ext Message-Args Null Real String) ; in: (raise error) ; [,bt for context] So I looked up the signature of `raise` and I get this: > raise - : (->* ((U (Rec flat (U (Pairof flat flat) Boolean Char Complex Keyword Null String Symbol)) exn)) (Any) (Nothing : (Bot | Bot))) #<procedure:raise> So what does this mean and what should I do? I am porting a module from my Neovim client which uses the MessagePack-RPC protocol, and part of the protocol is that any object that can be packed can be raised as an error. https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md#error Raising any object as an error would have allowed someone making an RPC request to just do something like this: (with-handlers ([packable? (λ (exn) (display exn))]) (rpc-request "foo" '#(bar))) What should I do instead? Create a new error type like `exn:fail:rpc`? Or am I missing something here? -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.