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..7c7533ba66f9b504438e09ba70240de6a9eb58a5 |
--- /dev/null |
+++ b/common/archive/ar/errors.go |
@@ -0,0 +1,46 @@ |
+// 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" |
+) |
+ |
+// Error indicates an error and if it is fatal or not. |
+type Error interface { |
mcgreevy
2016/11/07 00:37:22
There are a bunch of different error types in this
|
+ error |
+ Fatal() bool // Is the error fatal and the archive is now corrupted? |
+} |
+ |
+// UsageError indicates an error with using the archive/ar API. |
+type UsageError struct { |
mcgreevy
2016/11/07 00:37:22
This doesn't need to be a struct.
type UsageErr
|
+ msg string |
+} |
+ |
+func (e *UsageError) Error() string { |
+ return fmt.Sprintf("archive/ar: usage error, %s", e.msg) |
+} |
+ |
+// Fatal is always false for Usage. |
+func (e *UsageError) Fatal() bool { |
+ return false |
+} |
+ |
+// IOError indicates an error occurred during IO operations. |
+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) |
+} |
+ |
+// Fatal is always true for IOError. |
+func (e *IOError) Fatal() bool { |
+ return true |
+} |