Skip to content

Instantly share code, notes, and snippets.

@ktakashi
Created October 12, 2015 10:01
Show Gist options
  • Save ktakashi/f9fd61d78177153ac511 to your computer and use it in GitHub Desktop.
Save ktakashi/f9fd61d78177153ac511 to your computer and use it in GitHub Desktop.
Closed port error
(import (rnrs))
(guard (e ((i/o-error? e) (display "&i/o-error: ") (display e))
((assertion-violation? e) (display "&assertion: ") (display e))
(else (display "other: ") (display e)))
(let ((in (open-bytevector-input-port #vu8(1 2 3 4 5))))
(close-port in)
(get-u8 in)))
(flush-output-port (current-output-port))
#|
Petite Chez 8.4
&assertion: #<compound condition>
Iron Scheme
IronScheme TFS:109887 ironscheme.codeplex.com © 2007,2008,2009,2010,2011,2012,2013,2014 Llewellyn Pritchard (.NET 4.0 64-bit)
&assertion: &assertion
&who: get-u8
&message: "not binary-input-port"
&irritants: (#<binary-output-port>)
Racket (plt-r6rs)
other: #(struct:exn:fail read-byte: input port is closed #<continuation-mark-set>)
Mosh
&i/o-error: #<type:condition(#<#<type:record-type-descriptor&i/o-read #<type:record-type-descriptor&i/o #<type:record-type-descriptor&error #<type:record-type-descriptor&serious #<type:record-type-descriptor&condition #f &conidion-uid #f #f () > &serious-uid #f #f () > &error-uid #f #f () > &i/o-uid #f #f () > &i/o-read-uid #f #f () >> #<#<type:record-type-descriptor&who #<type:record-type-descriptor&condition #f &conidion-uid #f #f () > &who-uid #f #f ((#f . who)) ><byte-array-input-port> > #<#<type:record-type-descriptor&message #<type:record-type-descriptor&condition #f &conidion-uid #f #f () > &message-uid #f #f ((#f . message)) >get-u8 > #<#<type:record-type-descriptor&i/o-port #<type:record-type-descriptor&i/o #<type:record-type-descriptor&error #<type:record-type-descriptor&serious #<type:record-type-descriptor&condition #f &conidion-uid #f #f () > &serious-uid #f #f () > &error-uid #f #f () > &i/o-uid #f #f () > &i/o-port-uid #f #f ((#f . port)) >port is closed > #<#<type:record-type-descriptor&irritants #<type:record-type-descriptor&condition #f &conidion-uid #f #f () > &irritants-uid #f #f ((#f . irritants)) >(port is closed) >) >
Vicare
&assertion: #[r6rs-record: compound-condition components=(#[r6rs-record: &who who=get-u8] #[r6rs-record: &message message="expected open port as argument"] #[r6rs-record: &irritants irritants=(#<input-port (binary) "*bytevector-input-port*">)] #[r6rs-record: &procedure-argument-violation])]
Ypsilon
&assertion: #<condition (#<record &assertion> #<record &who get-u8> #<record &message "expected opened port, but got #<binary-input-port bytevector closed>"> #<record &irritants ()>)>
Guile
&assertion: #<r6rs:record:&compound-condition>
Sagittarius
&assertion: #<condition
#<&assertion>
#<&who get-u8>
#<&message "opened port" required, but got #<binary-input-port closed>>
#<&irritants ()>
#<stack-trace cause=#f>
>
|#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment