revert JSON comments upgrade, make HTTP error more verbose
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
Sam Therapy 2022-07-30 16:06:08 +02:00
parent bbf9f2ed7e
commit 896b582bd9
Signed by: sam
GPG key ID: 4D8B07C18F31ACBD
6 changed files with 10 additions and 10 deletions

Binary file not shown.

View file

@ -5,7 +5,7 @@
"command-line-usage": "6.1.3",
"got-cjs": "12.0.4",
"megalodon": "4.1.0",
"strip-json-comments": "5.0.0",
"strip-json-comments": "3.0.0",
"typescript": "4.7.4"
},
"name": "fediverse-imagebot",

View file

@ -7,10 +7,10 @@ import args from "./args.js";
* @param e Error object passed in from the error handler
* @returns This function will never return.
*/
export default function crashHandler(msg: string, e: Error) {
export default function crashHandler(msg: string, e: Error, res?: string) {
console.error(`${msg}: ${e.name}`);
if (args.verbose) {
console.error(`--BEGIN FULL ERROR--\n${e.message}\n--END FULL ERROR--`);
console.error(`--BEGIN FULL ERROR--\n${e}\n${res}\n--END FULL ERROR--`);
} else console.error("Run with -v to see the full error.");
exit(1);

View file

@ -28,8 +28,8 @@ export default async function postImage(
// Upload the image
const res: Response<Entity.Attachment> = await client
.uploadMedia(image)
.catch((err: Error) => {
crashHandler("Error uploading image.", err);
.catch((err) => {
crashHandler("Error uploading image.", err, err.response.data);
return {} as Response<Entity.Attachment>;
});

View file

@ -1157,7 +1157,7 @@ __metadata:
megalodon: 4.1.0
pkg: 5.8.0
prettier: 2.7.1
strip-json-comments: 5.0.0
strip-json-comments: 3.0.0
typescript: 4.7.4
bin:
fediverse-imagebot: dist/index.js
@ -2460,10 +2460,10 @@ __metadata:
languageName: node
linkType: hard
"strip-json-comments@npm:5.0.0":
version: 5.0.0
resolution: "strip-json-comments@npm:5.0.0"
checksum: 99cad07ccc3b86cc7bb8a9274a801b0660cbd595189ad291f6e206b8d7b23d90eed3119cdae44e126d9563796024b3ef0e7de2eeee4634b3b9019bafb62803e7
"strip-json-comments@npm:3.0.0":
version: 3.0.0
resolution: "strip-json-comments@npm:3.0.0"
checksum: 83c6bb238e8853cdce220d856b8140d22c81f41a8ba35dfc3230141c1565fb19c4664277652ea91853e4e8672dd1f31db1e682fc1c6cedc300e86c0542d42d1f
languageName: node
linkType: hard