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

Side by Side 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 unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698