nextflow icon indicating copy to clipboard operation
nextflow copied to clipboard

Scipio extended error report

Open mguinin opened this issue 2 years ago • 2 comments

Hi, thank you very much for developing nexflow. At Scipio-bioscience we created this fork because we felt the need to have more precise errors report. For now this fork is meant to be more functional than pretty, it is a work in progress.

Our problem was the lines reported in the error messages didn't always point the exact location where the error happened, but rather the general wrapping scope, furthermore the script names were not human readable (numbers) in the extended error stack in .nextflow.log

As our nextflow code grow in size we had more and more difficulties to find the new errors, so I created this hack were additional information is appended at the end of the cause chain of the error stack, so we are 100% sure the info is always displayed. Obviously it would be cleaner to move those message outside of the error stack. We are open to any suggestion.

Thanks again, Mathieu Guinin Scipio-bioscience [email protected]

mguinin avatar Jan 18 '22 09:01 mguinin

Please also review the contributing document https://github.com/nextflow-io/nextflow/blob/master/CONTRIBUTING.md#contributing-to-nextflow

pditommaso avatar Jan 20 '22 13:01 pditommaso

Thank you for considering my pull request ! I have done the change about the naming convention and remove the unwanted files from commit.

Here are two examples where the error report is improved:

  1. In the following example the error line in the console point to line 11, the proposed improvement allow to find the root cause of the problem at line 4. Notice that in this example the initCause wrapping is performed in the nextflow code, usually it gets even worse when it happens in groovy code: we frequently got the main workflow opening bracket as the error line.
nextflow.enable.dsl=2

def failTestFunc() {
    throw new Error("this is meant to fail")
}

workflow {
    try {
        failTestFunc()
    } catch (Throwable e) {
        throw new Error("something went wrong").initCause(e)
    }
}
  1. In this example nexflow only display the error message, not the full stack. The proposed improvement allow to retrieve the exact error line:
nextflow.enable.dsl=2

process failTestProcess {
    input:
        val(x)
    output:
        val(y)

    exec:
        throw new Error("this is meant to fail")
        y=2*x
}

workflow {
    failTestProcess(42)
}

mguinin avatar Jan 21 '22 17:01 mguinin

Closing as outdated

pditommaso avatar Feb 08 '23 21:02 pditommaso