Index: common/archive/ar/errors.go |
diff --git a/common/archive/ar/errors.go b/common/archive/ar/errors.go |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6cf8e5d85feafe32384f0365fa40cbb057d66b74 |
--- /dev/null |
+++ b/common/archive/ar/errors.go |
@@ -0,0 +1,44 @@ |
+// Copyright 2016 The LUCI Authors. All rights reserved. |
+// Use of this source code is governed under the Apache License, Version 2.0 |
+// that can be found in the LICENSE file. |
+ |
+// Write an ar archive file with BSD style filenames. |
+ |
+package ar |
+ |
+import ( |
+ "fmt" |
+) |
+ |
+type Error interface { |
+ error |
+ Fatal() bool // Is the error fatal and the archive is now corrupted? |
+} |
+ |
+// Indicates an error with using the archive/ar API. |
+type UsageError struct { |
M-A Ruel
2016/06/14 14:30:43
same comments as in writer.go
|
+ msg string |
+} |
+ |
+func (e *UsageError) Error() string { |
+ return fmt.Sprintf("archive/ar: usage error, %s", e.msg) |
+} |
+func (e *UsageError) Fatal() bool { |
+ return false |
+} |
+ |
+// Indicates an error with IO while using the archive/ar. This is always fatal. |
+// IOError indicates an error occurred during IO operations. |
+// IOError is always fatal. |
+type IOError struct { |
+ section string |
+ err error |
+} |
+ |
+func (e *IOError) Error() string { |
+ return fmt.Sprintf("archive/ar: io error (%s) during %s -- *archive corrupted*", e.err.Error(), e.section) |
+} |
+ |
+func (e *IOError) Fatal() bool { |
+ return true |
+} |