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

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: Small update to a comment. Created 4 years, 1 month 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..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
+}

Powered by Google App Engine
This is Rietveld 408576698