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

An error in a 'before' task hook makes 'error' hooks complain about not being called in a 'after/error' #95

Open
robinbourianes-kalisio opened this issue Nov 14, 2019 · 4 comments

Comments

@robinbourianes-kalisio
Copy link
Contributor

In this job for example : https://github.com/kalisio/c3x-arpege/blob/ef7bd729dcbcf14d435313904a683dd735603150/jobfile-arpege-0.1.js

If there's an error in connectFTP which is a before hook, then disconnectFTP called in the error hooks complains that it should only be called in a after/error hook as seen here
If the error happens in some of the after hooks, then error hooks work fine.

@claustres
Copy link
Member

claustres commented Nov 15, 2019

Also apply to some others hooks like

if ((hook.type !== 'after') && (hook.type !== 'error')) {

if ((hook.type !== 'after') && (hook.type !== 'error')) {

These restrictions are probably not required because we use the hook.data object available as well in a before hook, eg

export function disconnectMongo (options = {}) {

@robinbourianes-kalisio
Copy link
Contributor Author

But there's a bug right ?
The hook complaining that it's not being run in an 'after/error' context IS called in an 'error' context.
It's as if when an error happen in a 'before' hook the hook.type field is not updated correctly.

@claustres
Copy link
Member

Seems actually to be linked to this code part

export function callOnHookItems (f) {
because the error hook type is lost when calling the hook function.

@claustres
Copy link
Member

Closed by error, fixed bug by the commit was #92.

@claustres claustres reopened this Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Bugs
Development

No branches or pull requests

2 participants