Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | |
| 3 // that can be found in the LICENSE file. | |
| 4 | |
| 5 // Write an ar archive file with BSD style filenames. | |
| 6 | |
| 7 package ar | |
| 8 | |
| 9 import ( | |
| 10 "fmt" | |
| 11 ) | |
| 12 | |
| 13 type Error interface { | |
| 14 error | |
| 15 Fatal() bool // Is the error fatal and the archive is now corrupted? | |
| 16 } | |
| 17 | |
| 18 // Indicates an error with using the archive/ar API. | |
| 19 type UsageError struct { | |
|
M-A Ruel
2016/06/14 14:30:43
same comments as in writer.go
| |
| 20 msg string | |
| 21 } | |
| 22 | |
| 23 func (e *UsageError) Error() string { | |
| 24 return fmt.Sprintf("archive/ar: usage error, %s", e.msg) | |
| 25 } | |
| 26 func (e *UsageError) Fatal() bool { | |
| 27 return false | |
| 28 } | |
| 29 | |
| 30 // Indicates an error with IO while using the archive/ar. This is always fatal. | |
| 31 // IOError indicates an error occurred during IO operations. | |
| 32 // IOError is always fatal. | |
| 33 type IOError struct { | |
| 34 section string | |
| 35 err error | |
| 36 } | |
| 37 | |
| 38 func (e *IOError) Error() string { | |
| 39 return fmt.Sprintf("archive/ar: io error (%s) during %s -- *archive corr upted*", e.err.Error(), e.section) | |
| 40 } | |
| 41 | |
| 42 func (e *IOError) Fatal() bool { | |
| 43 return true | |
| 44 } | |
| OLD | NEW |