|
25 | 25 | import io.cdap.cdap.api.annotation.Name; |
26 | 26 | import io.cdap.cdap.api.annotation.Plugin; |
27 | 27 | import io.cdap.cdap.api.exception.ErrorCategory; |
| 28 | +import io.cdap.cdap.api.exception.ErrorCodeType; |
28 | 29 | import io.cdap.cdap.api.exception.ErrorType; |
29 | 30 | import io.cdap.cdap.api.exception.ErrorUtils; |
30 | 31 | import io.cdap.cdap.etl.api.FailureCollector; |
@@ -141,9 +142,12 @@ public void run(ActionContext context) throws Exception { |
141 | 142 | } else if (gcsPath.equals(bucketPath) && config.failIfExists()) { |
142 | 143 | // if the gcs path is just a bucket, and it exists, fail the pipeline |
143 | 144 | rollback = true; |
144 | | - String errorReason = String.format("Path %s already exists", gcsPath); |
145 | | - throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), |
146 | | - errorReason, errorReason, ErrorType.USER, true, null); |
| 145 | + String errorReason = String.format("Path %s already exists. " |
| 146 | + + "Please delete the existing path or set 'Fail if Object Exists' to false.", |
| 147 | + gcsPath); |
| 148 | + throw ErrorUtils.getProgramFailureException( |
| 149 | + new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), |
| 150 | + errorReason, errorReason, ErrorType.USER, true, null); |
147 | 151 | } |
148 | 152 | } |
149 | 153 |
|
@@ -171,9 +175,12 @@ public void run(ActionContext context) throws Exception { |
171 | 175 | } else { |
172 | 176 | if (config.failIfExists()) { |
173 | 177 | rollback = true; |
174 | | - String errorReason = String.format("Path %s already exists", gcsPath); |
175 | | - throw ErrorUtils.getProgramFailureException(new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), |
176 | | - errorReason, errorReason, ErrorType.SYSTEM, true, null); |
| 178 | + String errorReason = String.format("Path %s already exists. " |
| 179 | + + "Please delete the existing path or set 'Fail if Object Exists' to false.", |
| 180 | + gcsPath); |
| 181 | + throw ErrorUtils.getProgramFailureException( |
| 182 | + new ErrorCategory(ErrorCategory.ErrorCategoryEnum.PLUGIN), |
| 183 | + errorReason, errorReason, ErrorType.USER, false, null); |
177 | 184 | } |
178 | 185 | } |
179 | 186 | } |
|
0 commit comments