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 // Error indicates an error and if it is fatal or not. | |
14 type Error interface { | |
mcgreevy
2016/11/07 00:37:22
There are a bunch of different error types in this
| |
15 error | |
16 Fatal() bool // Is the error fatal and the archive is now corrupted? | |
17 } | |
18 | |
19 // UsageError indicates an error with using the archive/ar API. | |
20 type UsageError struct { | |
mcgreevy
2016/11/07 00:37:22
This doesn't need to be a struct.
type UsageErr
| |
21 msg string | |
22 } | |
23 | |
24 func (e *UsageError) Error() string { | |
25 return fmt.Sprintf("archive/ar: usage error, %s", e.msg) | |
26 } | |
27 | |
28 // Fatal is always false for Usage. | |
29 func (e *UsageError) Fatal() bool { | |
30 return false | |
31 } | |
32 | |
33 // IOError indicates an error occurred during IO operations. | |
34 type IOError struct { | |
35 section string | |
36 err error | |
37 } | |
38 | |
39 func (e *IOError) Error() string { | |
40 return fmt.Sprintf("archive/ar: io error (%s) during %s -- *archive corr upted*", e.err.Error(), e.section) | |
41 } | |
42 | |
43 // Fatal is always true for IOError. | |
44 func (e *IOError) Fatal() bool { | |
45 return true | |
46 } | |
OLD | NEW |