Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Test the new code in client.ts
  • Loading branch information
simhnna committed Sep 12, 2019
commit 4c2044964fb4892a4bfafc7239f82754aea3054f
13 changes: 12 additions & 1 deletion samples/client/petstore/typescript-node/npm/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,16 @@ petApi.addPet(pet)
})
.then((res) => {
console.log('Deleted pet');
process.exit(exitCode);
// process.exit(exitCode);
petApi.deletePet(petId).then((res) => {
throw new Error('Unexpected success');
}).catch((e) => {
if (e instanceof Error && e.name === 'HttpError' && e.message === 'HTTP request failed') {
console.log('Throws Http Errors correctly');
process.exit(exitCode);
} else {
throw new Error(`Throws unexpected error:\n ${e}`);
}
});
// process.exit(exitCode);
});