diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-06 22:37:27 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-06 22:37:27 +0000 |
commit | a756a05a63c16e653903ee8078d9760185cab545 (patch) | |
tree | 2bc668fae9bf96f9a3988e0b0a16685bde8c4f0b /libgo/go/text/tabwriter/tabwriter.go | |
parent | b9f71945eda675b307727a5d1b8455887ee30fee (diff) | |
download | gcc-a756a05a63c16e653903ee8078d9760185cab545.tar.gz |
libgo: Merge to master revision 19184.
The next revision, 19185, renames several runtime files, and
will be handled in a separate change.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211328 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/text/tabwriter/tabwriter.go')
-rw-r--r-- | libgo/go/text/tabwriter/tabwriter.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libgo/go/text/tabwriter/tabwriter.go b/libgo/go/text/tabwriter/tabwriter.go index 722ac8d877a..c0c32d5deca 100644 --- a/libgo/go/text/tabwriter/tabwriter.go +++ b/libgo/go/text/tabwriter/tabwriter.go @@ -434,9 +434,13 @@ func (b *Writer) terminateCell(htab bool) int { return len(*line) } -func handlePanic(err *error) { +func handlePanic(err *error, op string) { if e := recover(); e != nil { - *err = e.(osError).err // re-panics if it's not a local osError + if nerr, ok := e.(osError); ok { + *err = nerr.err + return + } + panic("tabwriter: panic during " + op) } } @@ -447,7 +451,7 @@ func handlePanic(err *error) { // func (b *Writer) Flush() (err error) { defer b.reset() // even in the presence of errors - defer handlePanic(&err) + defer handlePanic(&err, "Flush") // add current cell if not empty if b.cell.size > 0 { @@ -471,7 +475,7 @@ var hbar = []byte("---\n") // while writing to the underlying output stream. // func (b *Writer) Write(buf []byte) (n int, err error) { - defer handlePanic(&err) + defer handlePanic(&err, "Write") // split text into cells n = 0 |