Skip to content

Commit

Permalink
Remove extra context from workflow error message
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
pditommaso committed Mar 27, 2023
1 parent 77861b2 commit 38c8bd3
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 5 deletions.
7 changes: 2 additions & 5 deletions modules/nextflow/src/main/groovy/nextflow/Nextflow.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@ import java.nio.file.Files
import java.nio.file.NoSuchFileException
import java.nio.file.Path

import groovyx.gpars.dataflow.DataflowQueue
import groovyx.gpars.dataflow.DataflowReadChannel
import groovyx.gpars.dataflow.DataflowVariable
import nextflow.ast.OpXform
import nextflow.ast.OpXformImpl
import nextflow.exception.ProcessUnrecoverableException
import nextflow.exception.StopSplitIterationException
import nextflow.extension.CH
import nextflow.exception.WorkflowScriptErrorException
import nextflow.extension.GroupKey
import nextflow.extension.OperatorImpl
import nextflow.file.FileHelper
Expand Down Expand Up @@ -215,7 +212,7 @@ class Nextflow {
* @param message An optional error message
*/
static void error( String message = null ) {
throw message ? new ProcessUnrecoverableException(message) : new ProcessUnrecoverableException()
throw message ? new WorkflowScriptErrorException(message) : new WorkflowScriptErrorException()
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2020-2022, Seqera Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package nextflow.exception

/**
* Marker interface for exceptions that should not report any addintional context
* other the exception message
*
* @author Paolo Di Tommaso <paolo.ditommaso@gmail.com>
*/
interface PlainExceptionMessage {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2020-2022, Seqera Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package nextflow.exception

import groovy.transform.CompileStatic
import groovy.transform.InheritConstructors

/**
*
* @author Paolo Di Tommaso <paolo.ditommaso@gmail.com>
*/
@CompileStatic
@InheritConstructors
class WorkflowScriptErrorException extends ProcessUnrecoverableException implements PlainExceptionMessage {
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import nextflow.cli.CliOptions
import nextflow.cli.Launcher
import nextflow.exception.AbortOperationException
import nextflow.exception.ProcessException
import nextflow.exception.PlainExceptionMessage
import nextflow.exception.ScriptRuntimeException
import nextflow.extension.OpCall
import nextflow.file.FileHelper
Expand Down Expand Up @@ -491,6 +492,9 @@ class LoggerHelper {
else {
buffer.append("Unexpected error")
}
if( fail instanceof PlainExceptionMessage )
return

buffer.append(CoreConstants.LINE_SEPARATOR)
buffer.append(CoreConstants.LINE_SEPARATOR)

Expand Down

0 comments on commit 38c8bd3

Please sign in to comment.