|
27 | 27 | import com.netflix.metacat.common.exception.MetacatNotFoundException; |
28 | 28 | import com.netflix.metacat.common.exception.MetacatNotSupportedException; |
29 | 29 | import com.netflix.metacat.common.exception.MetacatPreconditionFailedException; |
30 | | -import com.netflix.metacat.common.exception.MetacatUnAuthorizedException; |
31 | 30 | import com.netflix.metacat.common.exception.MetacatUserMetadataException; |
32 | 31 | import com.netflix.metacat.common.exception.MetacatTooManyRequestsException; |
33 | 32 | import com.netflix.metacat.common.server.api.ratelimiter.RateLimiter; |
@@ -207,21 +206,16 @@ public <R> R processRequest( |
207 | 206 | final String message = String.format("%s.%s -- %s usermetadata operation failed for %s", e.getMessage(), |
208 | 207 | e.getCause() == null ? "" : e.getCause().getMessage(), resourceRequestName, name); |
209 | 208 | throw new MetacatUserMetadataException(message); |
210 | | - } catch (MetacatUnAuthorizedException e) { |
| 209 | + } catch (Exception e) { |
211 | 210 | collectRequestExceptionMetrics(tags, e.getClass().getSimpleName()); |
212 | 211 | final String message = String.format("%s.%s -- %s failed for %s", e.getMessage(), |
213 | 212 | e.getCause() == null ? "" : e.getCause().getMessage(), resourceRequestName, name); |
214 | 213 | log.error(message, e); |
215 | | - throw e; |
216 | | - } catch (MetacatTooManyRequestsException e) { |
217 | | - collectRequestExceptionMetrics(tags, e.getClass().getSimpleName()); |
218 | | - throw e; |
219 | | - } catch (Exception e) { |
220 | | - collectRequestExceptionMetrics(tags, e.getClass().getSimpleName()); |
221 | | - final String message = String.format("%s.%s -- %s failed for %s", e.getMessage(), |
222 | | - e.getCause() == null ? "" : e.getCause().getMessage(), resourceRequestName, name); |
223 | | - log.error(message, e); |
224 | | - throw new MetacatException(message, e); |
| 214 | + if (e instanceof MetacatException) { |
| 215 | + throw e; |
| 216 | + } else { |
| 217 | + throw new MetacatException(message, e); |
| 218 | + } |
225 | 219 | } finally { |
226 | 220 | final long duration = registry.clock().wallTime() - start; |
227 | 221 | log.info("### Time taken to complete {} for {} is {} ms", resourceRequestName, name, duration); |
@@ -272,7 +266,11 @@ public <R> R processRequest( |
272 | 266 | e.getMessage(), e.getCause() == null ? "" : e.getCause().getMessage(), |
273 | 267 | resourceRequestName); |
274 | 268 | log.error(message, e); |
275 | | - throw new MetacatException(message, e); |
| 269 | + if (e instanceof MetacatException) { |
| 270 | + throw e; |
| 271 | + } else { |
| 272 | + throw new MetacatException(message, e); |
| 273 | + } |
276 | 274 | } finally { |
277 | 275 | final long duration = registry.clock().wallTime() - start; |
278 | 276 | log.info("### Time taken to complete {} is {} ms", resourceRequestName, |
|
0 commit comments