|
| 1 | +// Package osm - Error codes for the adapter |
| 2 | +package osm |
| 3 | + |
| 4 | +import ( |
| 5 | + "fmt" |
| 6 | + |
| 7 | + "github.com/layer5io/meshkit/errors" |
| 8 | +) |
| 9 | + |
| 10 | +var ( |
| 11 | + // Error code for failed service mesh installation |
| 12 | + |
| 13 | + // ErrInstallOSMCode represents the errors which are generated |
| 14 | + // during open service mesh install process |
| 15 | + ErrInstallOSMCode = "osm_test_code" |
| 16 | + |
| 17 | + // ErrTarXZFCode represents the errors which are generated |
| 18 | + // during decompressing and extracting tar.gz file |
| 19 | + ErrTarXZFCode = "osm_test_code" |
| 20 | + |
| 21 | + // ErrMeshConfigCode represents the errors which are generated |
| 22 | + // when an invalid mesh config is found |
| 23 | + ErrMeshConfigCode = "osm_test_code" |
| 24 | + |
| 25 | + // ErrRunOsmCtlCmdCode represents the errors which are generated |
| 26 | + // during fetch manifest process |
| 27 | + ErrRunOsmCtlCmdCode = "osm_test_code" |
| 28 | + |
| 29 | + // ErrDownloadBinaryCode represents the errors which are generated |
| 30 | + // during binary download process |
| 31 | + ErrDownloadBinaryCode = "osm_test_code" |
| 32 | + |
| 33 | + // ErrInstallBinaryCode represents the errors which are generated |
| 34 | + // during binary installation process |
| 35 | + ErrInstallBinaryCode = "osm_test_code" |
| 36 | + |
| 37 | + // ErrSampleAppCode represents the errors which are generated |
| 38 | + // duing sample app installation |
| 39 | + ErrSampleAppCode = "osm_test_code" |
| 40 | + |
| 41 | + // ErrCustomOperationCode represents the errors which are generated |
| 42 | + // when an invalid addon operation is requested |
| 43 | + ErrCustomOperationCode = "osm_test_code" |
| 44 | + |
| 45 | + // ErrCreatingNSCode represents the errors which are generated |
| 46 | + // during the process of creating a namespace |
| 47 | + ErrCreatingNSCode = "osm_test_code" |
| 48 | + |
| 49 | + // ErrRunExecutableCode represents the errors which are generated |
| 50 | + // during the running a executable |
| 51 | + ErrRunExecutableCode = "osm_test_code" |
| 52 | + |
| 53 | + // ErrSidecarInjectionCode represents the errors which are generated |
| 54 | + // during the process of enabling/disabling sidecar injection |
| 55 | + ErrSidecarInjectionCode = "osm_test_code" |
| 56 | + |
| 57 | + // ErrOpInvalid represents the errors which are generated |
| 58 | + // when an invalid operation is requested |
| 59 | + ErrOpInvalid = errors.NewDefault(errors.ErrOpInvalid, "Invalid operation") |
| 60 | +) |
| 61 | + |
| 62 | +// ErrInstallOSM is the error for install mesh |
| 63 | +func ErrInstallOSM(err error) error { |
| 64 | + return errors.NewDefault(ErrInstallOSMCode, fmt.Sprintf("Error with osm operation: %s", err.Error())) |
| 65 | +} |
| 66 | + |
| 67 | +// ErrTarXZF is the error for unzipping the file |
| 68 | +func ErrTarXZF(err error) error { |
| 69 | + return errors.NewDefault(ErrTarXZFCode, fmt.Sprintf("Error while extracting file: %s", err.Error())) |
| 70 | +} |
| 71 | + |
| 72 | +// ErrMeshConfig is the error for mesh config |
| 73 | +func ErrMeshConfig(err error) error { |
| 74 | + return errors.NewDefault(ErrMeshConfigCode, fmt.Sprintf("Error configuration mesh: %s", err.Error())) |
| 75 | +} |
| 76 | + |
| 77 | +// ErrRunOsmCtlCmd is the error for mesh port forward |
| 78 | +func ErrRunOsmCtlCmd(err error, des string) error { |
| 79 | + return errors.NewDefault(ErrRunOsmCtlCmdCode, fmt.Sprintf("Error running osmctl command: %s", des)) |
| 80 | +} |
| 81 | + |
| 82 | +// ErrDownloadBinary is the error while downloading osm binary |
| 83 | +func ErrDownloadBinary(err error) error { |
| 84 | + return errors.NewDefault(ErrDownloadBinaryCode, fmt.Sprintf("Error downloading osmctl binary: %s", err.Error())) |
| 85 | +} |
| 86 | + |
| 87 | +// ErrInstallBinary is the error while downloading osm binary |
| 88 | +func ErrInstallBinary(err error) error { |
| 89 | + return errors.NewDefault(ErrInstallBinaryCode, fmt.Sprintf("Error installing osmctl binary: %s", err.Error())) |
| 90 | +} |
| 91 | + |
| 92 | +// ErrSampleApp is the error for streaming event |
| 93 | +func ErrSampleApp(err error) error { |
| 94 | + return errors.NewDefault(ErrSampleAppCode, fmt.Sprintf("Error with sample app operation: %s", err.Error())) |
| 95 | +} |
| 96 | + |
| 97 | +// ErrCustomOperation is the error for streaming event |
| 98 | +func ErrCustomOperation(err error) error { |
| 99 | + return errors.NewDefault(ErrCustomOperationCode, fmt.Sprintf("Error with custom operation: %s", err.Error())) |
| 100 | +} |
| 101 | + |
| 102 | +// ErrCreatingNS is the error while creating the namespace |
| 103 | +func ErrCreatingNS(err error) error { |
| 104 | + return errors.NewDefault(ErrCreatingNSCode, fmt.Sprintf("error creating namespace: %s", err.Error())) |
| 105 | +} |
| 106 | + |
| 107 | +// ErrRunExecutable is the error while running an executable |
| 108 | +func ErrRunExecutable(err error) error { |
| 109 | + return errors.NewDefault(ErrRunExecutableCode, fmt.Sprintf("error running executable: %s", err.Error())) |
| 110 | +} |
| 111 | + |
| 112 | +// ErrSidecarInjection is the error while enabling/disabling sidecar injection |
| 113 | +// on a particular namespace |
| 114 | +func ErrSidecarInjection(err error) error { |
| 115 | + return errors.NewDefault(ErrSidecarInjectionCode, fmt.Sprintf("error sidecar injection: %s", err.Error())) |
| 116 | +} |
0 commit comments