Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Unified Diff: common/archive/ar/errors.go

Issue 2043623002: luci-go: Tools for working with BSD style ar archives. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Latest fixes. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
+}

Powered by Google App Engine
This is Rietveld 408576698