Skip to content

Commit a850f4e

Browse files
committed
Set fake 404 status code when throwing NotFoundError for missing link
1 parent a7040f0 commit a850f4e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

endpoints/Endpoint.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HttpMethod, HttpHeader, HttpClient } from "../http";
1+
import { HttpMethod, HttpHeader, HttpStatusCode, HttpClient } from "../http";
22
import { Serializer } from "../serializers";
33
import { ErrorHandler, NotFoundError } from "../errors";
44
import { LinkExtractor, Link } from "../links";
@@ -188,7 +188,7 @@ export class Endpoint {
188188
const links = this.getLinks(rel);
189189

190190
if (links.length === 0)
191-
throw new NotFoundError(`No link with rel=${rel} provided by endpoint ${this.uri}.`, 0);
191+
throw new NotFoundError(`No link with rel=${rel} provided by endpoint ${this.uri}.`, HttpStatusCode.NotFound);
192192

193193
return links[0].uri;
194194
}
@@ -214,7 +214,7 @@ export class Endpoint {
214214
?? this.defaultLinkTemplates.get(rel);
215215

216216
if (!template)
217-
throw new NotFoundError(`No link template with rel=${rel} provided by endpoint ${this.uri}.`, 0);
217+
throw new NotFoundError(`No link template with rel=${rel} provided by endpoint ${this.uri}.`, HttpStatusCode.NotFound);
218218

219219
return template;
220220
}

0 commit comments

Comments
 (0)