quirrel-next icon indicating copy to clipboard operation
quirrel-next copied to clipboard

Undescriptive server error when trying to queue a task in the past / improper date

Open casesandberg opened this issue 5 years ago • 2 comments

I had a hard time getting up and running with this project and was hoping you could add some more helpful error handling on the backend to make the DX better?

To reproduce:

const runAt = new Date('Jan 1 2001')
await EmailQueue.enqueue({}, { runAt })

and

const runAt = { _seconds: 1608164625, _nanoseconds: 119000000 } // Firebase Firestore Date on record retrieval
await EmailQueue.enqueue({}, { runAt })

Output: Error: Unexpected status: 500

Would be great to see errors like "Items can not be queued to run in the past" or "Your runAt date is not in the correct format", etc...

casesandberg avatar Dec 17 '20 19:12 casesandberg

Uhh, apologies for the bad experience. I assume you're not using TypeScript, right? Until now, I (somehow) just assumed that providing types would be enough. Having actual development runtime checks make a whole lot of sense! I'll add some developer-focused error messages for that :)

Skn0tt avatar Dec 17 '20 23:12 Skn0tt

We are using Typescript. There was a bug in the definition file from firebase that was typing their Timestamp as a Date. Thanks!

casesandberg avatar Dec 18 '20 00:12 casesandberg