You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
The proposed type check is #210 will require the user to return in this case:
if(listId===undefined){complete.failure(`No list configuration found for ${listName}`);// Job failed. Execution should have stopped here, but hasn't}try{awaitthis.emailService.addToList(email,listId);complete.success();}catch(e){this.logError(e);complete.failure(e.message);}
That will catch the subtle bug where the addToList side-effect is executed after the job is marked as failed. The programmer intended execution to halt at that point.
Even with the type check in #210, however, it can still be written like this:
if(listId===undefined){complete.failure(`No list configuration found for ${listName}`);// Job failed. Execution should have stopped here, but hasn't // Doesn't need to return, because the type checker sees the subsequent complete.success()}try{awaitthis.emailService.addToList(email,listId);returncomplete.success();// now returns}catch(e){this.logError(e);returncomplete.failure(e.message);// now returns}
It now type-checks - all code paths return an action acknowledgement - but it still has the bug.
It would be best to make impossible states impossible to model, but I think this beyond the power of the type system.
This feature is to emit a big red warning to the logger when two job action methods are called for the same job. We can detect that this is a bug, and is definitely impossible behaviour.
I can't see a way to make it impossible to write, but we can have it make noise when it is run.
The text was updated successfully, but these errors were encountered:
The proposed type check is #210 will require the user to return in this case:
That will catch the subtle bug where the
addToList
side-effect is executed after the job is marked as failed. The programmer intended execution to halt at that point.Even with the type check in #210, however, it can still be written like this:
It now type-checks - all code paths return an action acknowledgement - but it still has the bug.
It would be best to make impossible states impossible to model, but I think this beyond the power of the type system.
This feature is to emit a big red warning to the logger when two job action methods are called for the same job. We can detect that this is a bug, and is definitely impossible behaviour.
I can't see a way to make it impossible to write, but we can have it make noise when it is run.
The text was updated successfully, but these errors were encountered: