Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Revision through web from Harald Oehlmann <[email protected]> Formatting |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
500787b368be25c1f5b894891eaffc82 |
User & Date: | tclhttpd 2014-04-24 20:48:44.000 |
Context
2014-04-24
| ||
20:51 | Revision through web from Harald Oehlmann <[email protected]> check-in: 673e95e709 user: tclhttpd tags: trunk | |
20:48 | Revision through web from Harald Oehlmann <[email protected]> Formatting check-in: 500787b368 user: tclhttpd tags: trunk | |
20:46 | Revision through web from Harald Oehlmann <[email protected]> Added example and perspective for fconfigure -lasterror corresponding function. check-in: e1aea0a918 user: tclhttpd tags: trunk | |
Changes
Changes to tip/428.tip.
1 2 | TIP: 428 Title: Produce Error Dictionary from 'fconfigure -error' | | | 1 2 3 4 5 6 7 8 9 10 | TIP: 428 Title: Produce Error Dictionary from 'fconfigure -error' Version: $Revision: 1.6 $ Author: Harald Oehlmann <[email protected]> Author: Harald Oehlmann <[email protected]> State: Draft Type: Project Vote: Pending Created: 16-Mar-2014 Post-History: |
︙ | ︙ | |||
48 49 50 51 52 53 54 | The following example demonstrates the use. It checks for an error, closes the channel on error and propages the error to the caller: |if {[catch {fconfigure $h -throwerror} e d]} { | catch {close $h} | puts "$h:$d" | | < < | | | | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | The following example demonstrates the use. It checks for an error, closes the channel on error and propages the error to the caller: |if {[catch {fconfigure $h -throwerror} e d]} { | catch {close $h} | puts "$h:$d" | # -> returns "connection refused:-code 1 -level 0 -errorcode {POSIX ECONNREFUSED {connection refused}} -errorinfo {couldn't open socket: connection refused" | # fail with the error | unset d -level | return -options $d $e |} ~ Alternatives Revision 1.2 of this TIP proposed to return an error dict like '''d''' in '''catch {code} e d'''. This approach had the following issues: * A new member must be invented to include the error message * The standard error mechanisms like '''catch''' may not be used to detect the error occurence. Instead, a comparison of a dict member must be done. ~ Further perspectives Here are the fconfigure options with similar functionality: * '''fconfigure -lasterror''': serial, win only: returns something like the second component of an errorCode list: '''lindex $::errorCode 1''' > * channel must not be closed, serial errors may be temporary. * '''fconfigure -error''': socket, all platforms: returns an error message > * channel must be closed, no way to recover (with tcp). > * '''fconfigure -throwerror''' may also be implemented for the windows serial driver. ~ Implementation Implementation might be available soon. ~ Copyright This document has been placed in the public domain. |