Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
return HttpError according to status code
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihaydilek committed Nov 26, 2020
1 parent 2d41f93 commit 260b19f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/wrappers/WebWrapperUtils.ts
Expand Up @@ -21,6 +21,7 @@ import InvocationTraceSupport from '../plugins/support/InvocationTraceSupport';
import { HttpTags, DomainNames, ClassNames, SpanTags, TriggerHeaderTags } from '../Constants';
import ThundraSpanContext from '../opentracing/SpanContext';
import { ApplicationInfo } from '../application/ApplicationInfo';
import HttpError from '../error/HttpError';

const get = require('lodash.get');

Expand All @@ -45,7 +46,7 @@ export default class WebWrapperUtils {
const context = ExecutionContextManager.get();

if (!context.error && response.statusCode >= 500) {
context.error = Utils.buildError(new Error(response.statusMessage));
context.error = new HttpError(`Returned with status code ${response.statusCode}.`);
}

context.finishTimestamp = Date.now();
Expand Down

0 comments on commit 260b19f

Please sign in to comment.