Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't throw errors #501

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"typescript-eslint": "^7.5.0",
"unplugin-swc": "1.4.4",
"vitest": "1.3.1",
"wsdl-tsclient": "1.3.1"
"wsdl-tsclient": "1.3.1",
"catch-unknown": "2.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, catch-unknown, finally (pun intended)! But, can you move this to normal dependencies instead of dev-seps?

},
"lint-staged": {
"*.{js,ts,css,less,scss,vue,json,gql,md,astro,yaml,yml,html,hbs,gitignore}": [
Expand Down
4 changes: 4 additions & 0 deletions packages/vendure-plugin-shipmate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.2.4 (2024-08-27)

- Don't throw erros from `/shipmate` endpoint (#509)
martijnvdbrug marked this conversation as resolved.
Show resolved Hide resolved

# 1.2.3 (2024-08-20)

- Log warning when failed to cancel a shipment in Shipmate
Expand Down
2 changes: 1 addition & 1 deletion packages/vendure-plugin-shipmate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-shipmate",
"version": "1.2.3",
"version": "1.2.4",
"description": "Vendure plugin for integration with Shipmate",
"icon": "truck",
"author": "Martijn van de Brug <martijn@pinelab.studio>",
Expand Down
13 changes: 11 additions & 2 deletions packages/vendure-plugin-shipmate/src/api/shipmate.controller.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import { Controller, Post, Body } from '@nestjs/common';
import { EventPayload } from '../types';
import { ShipmateService } from './shipmate.service';
import { RequestContext, Ctx } from '@vendure/core';
import { RequestContext, Ctx, Logger } from '@vendure/core';
import { asError } from 'catch-unknown';

@Controller('shipmate')
export class ShipmateController {
constructor(private shipmentService: ShipmateService) {}
@Post()
async event(@Ctx() ctx: RequestContext, @Body() payload: EventPayload) {
await this.shipmentService.updateOrderState(payload);
try {
await this.shipmentService.updateOrderState(payload);
} catch (e) {
Logger.error(
`Shipmate Order state update failed with the message: ${
asError(e).message
}`
);
}
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7287,6 +7287,11 @@ caseless@~0.12.0:
resolved "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz"
integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==

catch-unknown@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/catch-unknown/-/catch-unknown-2.0.0.tgz#934bb9ccd5b15599680db1cdc680d934f12a2003"
integrity sha512-4ELowf+Fp6Qwv77ZvRDto9oJMsOalEk8IYvS5KsmIhRZQWbfArlIhIOONJtmCzOeeqpip6JzYqAYaNR9sIyLVQ==

chai@^4.3.10:
version "4.4.1"
resolved "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz"
Expand Down
Loading