[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-05-11 Thread scm_issue_l...@java.net (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 SCM/JIRA link daemon commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Code changed in jenkins User: Jesse Glick Path: test/src/test/java/hudson/cli/GetNodeCommandTest.java test/src/test/java/hudson/cli/UpdateNodeCommandTest.java http://jenkins-ci.org/commit/jenkins/9f3f352ee989c861e5304dc0ac4e7b06f7fd1403 Log: 

JENKINS-32273
 CLI exit codes changed as of #1997 in 1.649. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-22 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek resolved as Fixed 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Jenkins /  JENKINS-32273 
 
 
 
  Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 

Change By:
 
 Pavel Janoušek 
 
 
 

Status:
 
 Open Resolved 
 
 
 

Resolution:
 
 Fixed 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-19 Thread dogf...@java.net (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 dogfood commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Integrated in  jenkins_main_trunk #4458 JENKINS-32273 Refactored return error codes and messages (Revision 49d9f0e1b5872b7eea4d22c8b5edd634cc28e9f6) JENKINS-32273 Unified an issue handling in CLI (Revision d5725e6d18c0bcd4a2640943eaea059f137786bc) 
 Result = SUCCESS pjanouse : 49d9f0e1b5872b7eea4d22c8b5edd634cc28e9f6 Files :  
 

core/src/main/java/hudson/cli/CLICommand.java
 
 
pjanouse : d5725e6d18c0bcd4a2640943eaea059f137786bc Files :  
 

test/src/test/java/hudson/cli/SetBuildDisplayNameCommandTest.java
 

core/src/main/java/hudson/cli/DeleteNodeCommand.java
 

core/src/main/java/hudson/cli/handlers/GenericItemOptionHandler.java
 

test/src/test/java/hudson/cli/UpdateViewCommandTest.java
 

core/src/test/java/hudson/cli/ListJobsCommandTest.java
 

core/src/main/java/hudson/cli/GroovyCommand.java
 

core/src/main/java/hudson/cli/handlers/ViewOptionHandler.java
 

test/src/test/java/hudson/cli/GetViewCommandTest.java
 

test/src/test/java/hudson/cli/CopyJobCommandTest.java
 

core/src/test/java/hudson/cli/handlers/ViewOptionHandlerTest.java
 

core/src/main/java/hudson/cli/InstallPluginCommand.java
 

core/src/main/java/hudson/cli/CommandDuringBuild.java
 

test/src/test/groovy/hudson/cli/BuildCommandTest.groovy
 

test/src/test/java/hudson/cli/ViewManipulationTest.java
 
   

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-19 Thread scm_issue_l...@java.net (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 SCM/JIRA link daemon commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Code changed in jenkins User: Ing. Pavel Janousek Path: core/src/main/java/hudson/cli/CLICommand.java http://jenkins-ci.org/commit/jenkins/49d9f0e1b5872b7eea4d22c8b5edd634cc28e9f6 Log: JENKINS-32273 Refactored return error codes and messages 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-19 Thread scm_issue_l...@java.net (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 SCM/JIRA link daemon commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Code changed in jenkins User: Ing. Pavel Janousek Path: core/src/main/java/hudson/cli/AddJobToViewCommand.java core/src/main/java/hudson/cli/BuildCommand.java core/src/main/java/hudson/cli/CLIAction.java core/src/main/java/hudson/cli/CLICommand.java core/src/main/java/hudson/cli/CliProtocol.java core/src/main/java/hudson/cli/CliProtocol2.java core/src/main/java/hudson/cli/ClientAuthenticationCache.java core/src/main/java/hudson/cli/CommandDuringBuild.java core/src/main/java/hudson/cli/ConsoleCommand.java core/src/main/java/hudson/cli/CopyJobCommand.java core/src/main/java/hudson/cli/CreateJobCommand.java core/src/main/java/hudson/cli/CreateNodeCommand.java core/src/main/java/hudson/cli/CreateViewCommand.java core/src/main/java/hudson/cli/DeleteJobCommand.java core/src/main/java/hudson/cli/DeleteNodeCommand.java core/src/main/java/hudson/cli/DeleteViewCommand.java core/src/main/java/hudson/cli/GroovyCommand.java core/src/main/java/hudson/cli/GroovyshCommand.java core/src/main/java/hudson/cli/HelpCommand.java core/src/main/java/hudson/cli/InstallPluginCommand.java core/src/main/java/hudson/cli/InstallToolCommand.java core/src/main/java/hudson/cli/ListJobsCommand.java core/src/main/java/hudson/cli/ListPluginsCommand.java core/src/main/java/hudson/cli/OnlineNodeCommand.java core/src/main/java/hudson/cli/ReloadJobCommand.java core/src/main/java/hudson/cli/RemoveJobFromViewCommand.java core/src/main/java/hudson/cli/SetBuildDisplayNameCommand.java core/src/main/java/hudson/cli/declarative/CLIRegisterer.java core/src/main/java/hudson/cli/handlers/GenericItemOptionHandler.java core/src/main/java/hudson/cli/handlers/NodeOptionHandler.java core/src/main/java/hudson/cli/handlers/ViewOptionHandler.java core/src/test/java/hudson/cli/ListJobsCommandTest.java core/src/test/java/hudson/cli/handlers/ViewOptionHandlerTest.java test/src/test/groovy/hudson/cli/BuildCommandTest.groovy test/src/test/java/hudson/cli/CLIRegistererTest.java test/src/test/java/hudson/cli/CopyJobCommandTest.java test/src/test/java/hudson/cli/CreateJobCommandTest.java test/src/test/java/hudson/cli/CreateNodeCommandTest.java test/src/test/java/hudson/cli/CreateViewCommandTest.java test/src/test/java/hudson/cli/DeleteJobCommandTest.java test/src/test/java/hudson/cli/DeleteNodeCommandTest.java test/src/test/java/hudson/cli/DeleteViewCommandTest.java test/src/test/java/hudson/cli/GetNodeCommandTest.java test/src/test/java/hudson/cli/GetViewCommandTest.java test/src/test/java/hudson/cli/OnlineNodeCommandTest.java test/src/test/java/hudson/cli/ReloadJobCommandTest.java test/src/test/java/hudson/cli/SetBuildDisplayNameCommandTest.java test/src/test/java/hudson/cli/UpdateNodeCommandTest.java test/src/test/java/hudson/cli/UpdateViewCommandTest.java test/src/test/java/hudson/cli/ViewManipulationTest.java test/src/test/java/jenkins/security/Security218CliTest.java http://jenkins-ci.org/commit/jenkins/d5725e6d18c0bcd4a2640943eaea059f137786bc Log: JENKINS-32273 Unified an issue handling in CLI 
Re-factored all existed CLI code to follow the new proposed scheme for raising an exception if issue occurs, handling and reporting it. Unified CLIRegisterer as well. Fixed unit tests to follow the new scheme. 
 
 
 
 
 
 
 
 
 
 
 
 

  

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-19 Thread scm_issue_l...@java.net (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 SCM/JIRA link daemon commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Code changed in jenkins User: Oliver Gondža Path: core/src/main/java/hudson/cli/AddJobToViewCommand.java core/src/main/java/hudson/cli/BuildCommand.java core/src/main/java/hudson/cli/CLIAction.java core/src/main/java/hudson/cli/CLICommand.java core/src/main/java/hudson/cli/CliProtocol.java core/src/main/java/hudson/cli/CliProtocol2.java core/src/main/java/hudson/cli/ClientAuthenticationCache.java core/src/main/java/hudson/cli/CommandDuringBuild.java core/src/main/java/hudson/cli/ConsoleCommand.java core/src/main/java/hudson/cli/CopyJobCommand.java core/src/main/java/hudson/cli/CreateJobCommand.java core/src/main/java/hudson/cli/CreateNodeCommand.java core/src/main/java/hudson/cli/CreateViewCommand.java core/src/main/java/hudson/cli/DeleteJobCommand.java core/src/main/java/hudson/cli/DeleteNodeCommand.java core/src/main/java/hudson/cli/DeleteViewCommand.java core/src/main/java/hudson/cli/GroovyCommand.java core/src/main/java/hudson/cli/GroovyshCommand.java core/src/main/java/hudson/cli/HelpCommand.java core/src/main/java/hudson/cli/InstallPluginCommand.java core/src/main/java/hudson/cli/InstallToolCommand.java core/src/main/java/hudson/cli/ListJobsCommand.java core/src/main/java/hudson/cli/ListPluginsCommand.java core/src/main/java/hudson/cli/OnlineNodeCommand.java core/src/main/java/hudson/cli/ReloadJobCommand.java core/src/main/java/hudson/cli/RemoveJobFromViewCommand.java core/src/main/java/hudson/cli/SetBuildDisplayNameCommand.java core/src/main/java/hudson/cli/declarative/CLIRegisterer.java core/src/main/java/hudson/cli/handlers/GenericItemOptionHandler.java core/src/main/java/hudson/cli/handlers/NodeOptionHandler.java core/src/main/java/hudson/cli/handlers/ViewOptionHandler.java core/src/test/java/hudson/cli/ListJobsCommandTest.java core/src/test/java/hudson/cli/handlers/ViewOptionHandlerTest.java test/src/test/groovy/hudson/cli/BuildCommandTest.groovy test/src/test/java/hudson/cli/CLIRegistererTest.java test/src/test/java/hudson/cli/CopyJobCommandTest.java test/src/test/java/hudson/cli/CreateJobCommandTest.java test/src/test/java/hudson/cli/CreateNodeCommandTest.java test/src/test/java/hudson/cli/CreateViewCommandTest.java test/src/test/java/hudson/cli/DeleteJobCommandTest.java test/src/test/java/hudson/cli/DeleteNodeCommandTest.java test/src/test/java/hudson/cli/DeleteViewCommandTest.java test/src/test/java/hudson/cli/GetNodeCommandTest.java test/src/test/java/hudson/cli/GetViewCommandTest.java test/src/test/java/hudson/cli/OnlineNodeCommandTest.java test/src/test/java/hudson/cli/ReloadJobCommandTest.java test/src/test/java/hudson/cli/SetBuildDisplayNameCommandTest.java test/src/test/java/hudson/cli/UpdateNodeCommandTest.java test/src/test/java/hudson/cli/UpdateViewCommandTest.java test/src/test/java/hudson/cli/ViewManipulationTest.java test/src/test/java/jenkins/security/Security218CliTest.java http://jenkins-ci.org/commit/jenkins/fe41dc89ab9801c9d57713f84e650788e172e115 Log: Merge pull request #1997 from pjanouse/JENKINS-32273 
JENKINS-32273 Unified an issue handling in CLI 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
   

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-12 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Jenkins /  JENKINS-32273 
 
 
 
  Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 

Change By:
 
 Pavel Janoušek 
 
 
 
 
 
 
 
 
 
 TL;DR;The aim of this JIRA is to start unification of an issue handling in CLI commands.Details:Currently there is a discrepancy between returned error codes if an issue occurred during execution. It depends on the fact whether the CLI command is implemented as {{@CLIMethod}} or extending {{hudson.cli.CLICommand}} class.{{@CLIMethod}} usually returns 1 in the case an issue occurred, similar situation in {{hudson.cli.CLICommand}} returns -1 to the shell.There is an ongoing effort to extract all CLI commands from the Core to CLI (see JENKINS-22969), so the discrepancy should be removed shortly and consistent error code definition should be set-up on one place only - in {{hudson.cli.CLICommand}}.Currently we should use this semantic in CLI:* 0 means All right* -1 means An error occurredTechnically anything else than zero means an issue occurred. Later we can use more precisely defined error codes for the different issues if useful.Update 07-Jan-2016 ({color:red}WIP{color}):TODO- Refactor core commands to use correct exception classes- Update javadoc for {{CLICommand#run}}- Unify the handling in {{CLIRegisterer}}Proposed a new unified scheme of exception raising, handling, reporting and error code returning:|| Exception name || Meaning || Correct usage || Incorrect usage || Processing || Return code ||| CmdLineException | Wrong parameter, input value can't be decoded etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L75] | * [AddJobToViewCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/AddJobToViewCommand.java#L58-L59] -> IllegalStateException \\* [ConsoleCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/ConsoleCommand.java#L53] -> IllegalArgumentException | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr \\* print usage help | 2 || IllegalStateException | Can't continue due to an incorrect state of Jenkins instance, job, build etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L58] \\comes from Jenkins.getActiveInstance() | none | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr | 4 || IllegalArgumentException | Can't continue due to wrong input parameter (job doesn't exist etc.) | [CopyJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CopyJobCommand.java#L66] | * [CreateJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CreateJobCommand.java#L67] -> IllegalStateException | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr | 3 || AbortException | Can't continue due to an other (rare) issue \\Note: Current usage of this exception is wrong, usually there should be IllegalState or CmdLine exception raised instead of this | none | * [BuildCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/BuildCommand.java#L129] -> CmdLineException \\* 

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-12 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Jenkins /  JENKINS-32273 
 
 
 
  Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 

Change By:
 
 Pavel Janoušek 
 
 
 
 
 
 
 
 
 
 TL;DR;The aim of this JIRA is to start unification of an issue handling in CLI commands.Details:Currently there is a discrepancy between returned error codes if an issue occurred during execution. It depends on the fact whether the CLI command is implemented as {{@CLIMethod}} or extending {{hudson.cli.CLICommand}} class.{{@CLIMethod}} usually returns 1 in the case an issue occurred, similar situation in {{hudson.cli.CLICommand}} returns -1 to the shell.There is an ongoing effort to extract all CLI commands from the Core to CLI (see JENKINS-22969), so the discrepancy should be removed shortly and consistent error code definition should be set-up on one place only - in {{hudson.cli.CLICommand}}.Currently we should use this semantic in CLI:* 0 means All right* -1 means An error occurredTechnically anything else than zero means an issue occurred. Later we can use more precisely defined error codes for the different issues if useful.Update 07-Jan-2016 ({color:red}WIP{color}):TODO- Refactor core commands to use correct exception classes- Update javadoc for {{CLICommand#run}}- Unify the handling in {{CLIRegisterer}}Proposed a new unified scheme of exception raising, handling, reporting and error code returning:Update 12-Feb-2016: - {{Exception}} -> {{Throwable}}|| Exception name || Meaning || Correct usage || Incorrect usage || Processing || Return code ||| CmdLineException | Wrong parameter, input value can't be decoded etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L75] | * [AddJobToViewCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/AddJobToViewCommand.java#L58-L59] -> IllegalStateException \\* [ConsoleCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/ConsoleCommand.java#L53] -> IllegalArgumentException | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr \\* print usage help | 2 || IllegalStateException | Can't continue due to an incorrect state of Jenkins instance, job, build etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L58] \\comes from Jenkins.getActiveInstance() | none | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr | 4 || IllegalArgumentException | Can't continue due to wrong input parameter (job doesn't exist etc.) | [CopyJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CopyJobCommand.java#L66] | * [CreateJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CreateJobCommand.java#L67] -> IllegalStateException | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr | 3 || AbortException | Can't continue due to an other (rare) issue \\Note: Current usage of this exception is wrong, usually there should be IllegalState or CmdLine exception raised instead of this | none | * [BuildCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/BuildCommand.java#L129] -> 

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-12 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Jenkins /  JENKINS-32273 
 
 
 
  Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 

Change By:
 
 Pavel Janoušek 
 
 
 
 
 
 
 
 
 
 TL;DR;The aim of this JIRA is to start unification of an issue handling in CLI commands.Details:Currently there is a discrepancy between returned error codes if an issue occurred during execution. It depends on the fact whether the CLI command is implemented as {{@CLIMethod}} or extending {{hudson.cli.CLICommand}} class.{{@CLIMethod}} usually returns 1 in the case an issue occurred, similar situation in {{hudson.cli.CLICommand}} returns -1 to the shell.There is an ongoing effort to extract all CLI commands from the Core to CLI (see JENKINS-22969), so the discrepancy should be removed shortly and consistent error code definition should be set-up on one place only - in {{hudson.cli.CLICommand}}.Currently we should use this semantic in CLI:* 0 means All right* -1 means An error occurredTechnically anything else than zero means an issue occurred. Later we can use more precisely defined error codes for the different issues if useful.Update 07-Jan-2016 ({color:red}WIP{color}):TODO- Refactor core commands to use correct exception classes- Update javadoc for {{CLICommand#run}}- Unify the handling in {{CLIRegisterer}}Proposed a new unified scheme of exception raising, handling, reporting and error code returning:Update 12-Feb-2016 :  - {{Exception}} -> {{Throwable}}|| Exception name || Meaning || Correct usage || Incorrect usage || Processing || Return code ||| CmdLineException | Wrong parameter, input value can't be decoded etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L75] | * [AddJobToViewCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/AddJobToViewCommand.java#L58-L59] -> IllegalStateException \\* [ConsoleCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/ConsoleCommand.java#L53] -> IllegalArgumentException | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr \\* print usage help | 2 || IllegalStateException | Can't continue due to an incorrect state of Jenkins instance, job, build etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L58] \\comes from Jenkins.getActiveInstance() | none | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr | 4 || IllegalArgumentException | Can't continue due to wrong input parameter (job doesn't exist etc.) | [CopyJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CopyJobCommand.java#L66] | * [CreateJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CreateJobCommand.java#L67] -> IllegalStateException | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr | 3 || AbortException | Can't continue due to an other (rare) issue \\Note: Current usage of this exception is wrong, usually there should be IllegalState or CmdLine exception raised instead of this | none | * [BuildCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/BuildCommand.java#L129] -> 

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-12 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Jenkins /  JENKINS-32273 
 
 
 
  Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 

Change By:
 
 Pavel Janoušek 
 
 
 
 
 
 
 
 
 
 TL;DR;The aim of this JIRA is to start unification of an issue handling in CLI commands.Details:Currently there is a discrepancy between returned error codes if an issue occurred during execution. It depends on the fact whether the CLI command is implemented as {{@CLIMethod}} or extending {{hudson.cli.CLICommand}} class.{{@CLIMethod}} usually returns 1 in the case an issue occurred, similar situation in {{hudson.cli.CLICommand}} returns -1 to the shell.There is an ongoing effort to extract all CLI commands from the Core to CLI (see JENKINS-22969), so the discrepancy should be removed shortly and consistent error code definition should be set-up on one place only - in {{hudson.cli.CLICommand}}.Currently we should use this semantic in CLI:* 0 means All right* -1 means An error occurredTechnically anything else than zero means an issue occurred. Later we can use more precisely defined error codes for the different issues if useful.Update 07-Jan-2016 ({color:red}WIP{color}):TODO- Refactor core commands to use correct exception classes- Update javadoc for {{CLICommand#run}}- Unify the handling in {{CLIRegisterer}}Proposed a new unified scheme of exception raising, handling, reporting and error code returning: Update 12-Feb-2016 - {{Exception}} -> {{Throwable}}   || Exception name || Meaning || Correct usage || Incorrect usage || Processing || Return code ||| CmdLineException | Wrong parameter, input value can't be decoded etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L75] | * [AddJobToViewCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/AddJobToViewCommand.java#L58-L59] -> IllegalStateException \\* [ConsoleCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/ConsoleCommand.java#L53] -> IllegalArgumentException | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr \\* print usage help | 2 || IllegalStateException | Can't continue due to an incorrect state of Jenkins instance, job, build etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L58] \\comes from Jenkins.getActiveInstance() | none | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr | 4 || IllegalArgumentException | Can't continue due to wrong input parameter (job doesn't exist etc.) | [CopyJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CopyJobCommand.java#L66] | * [CreateJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CreateJobCommand.java#L67] -> IllegalStateException | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr | 3 || AbortException | Can't continue due to an other (rare) issue \\Note: Current usage of this exception is wrong, usually there should be IllegalState or CmdLine exception raised instead of this | none | * [BuildCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/BuildCommand.java#L129] 

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-12 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek edited a comment on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 {{ Exception }}  isn't enough general for example for Java language {{assert}} code (produces {{java.lang.AssertionException}} which isn't derived from {{java.lang.Exception}}). We have to  catch an unchecked exception as well, so I've changed {{Exception}} to {{Throwable}} as the most general standpoint if anything unknown goes wrong. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-12 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Exception isn't enough general for example for Java language assert code (produces java.lang.AssertionException which isn't derived from java.lang.Exception). We have to catch an unchecked exception as well, so I've changed Exception to Throwable as the most general standpoint if anything unknown goes wrong. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-12 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek edited a comment on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 {{Exception}} isn't enough general  for  standpoint. For  example  for  Java language {{assert}} code ( produces raises  {{java.lang.AssertionException}} which isn't derived from {{java.lang.Exception}}). We have to  catch an unchecked exception as well, so I've changed {{Exception}} to {{Throwable}} as the most general standpoint if anything unknown goes wrong. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-04 Thread te...@java.net (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 James Nord edited a comment on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 @danielBeck - I  see  suggest  your example of rename not the correct use case here - basically what we are trying to say is - the command ran perfectly fine and did exactly what you asked it to - but there is nothing to report / no side effects.This is distinct from the command not doing what you asked due to some reason (the job you asked it to rename already exists)e.g. consider a fictional CLI command {{isJenkinsInQueitDownMode}}.to be usable by scripts you would want 2 different exit codes (but both mean the command ran ok) - 0 would be false, 1 would be true and >1 is error_something_bad_happened.  Otherwise you need to output some text - and that text should be localizable for humans - which means you need to write a whole boat load of code on your script to both parse the response and generate the outpu - ie a --machine-output=true flag)So {{1}} is not an error case and it is not for "forseeable errors" - its where the CLI wants to say Hey I ran successfully but  (similar to {{grep foo bar}} when bar does not contain foo. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-02-04 Thread te...@java.net (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 James Nord commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
@danielBeck - I see your example of rename not the correct use case here - basically what we are trying to say is - the command ran perfectly fine and did exactly what you asked it to - but there is nothing to report / no side effects. 
This is distinct from the command not doing what you asked due to some reason (the job you asked it to rename already exists) 
e.g. consider a fictional CLI command isJenkinsInQueitDownMode. 
to be usable by scripts you would want 2 different exit codes (but both mean the command ran ok) - 0 would be false, 1 would be true and >1 is error_something_bad_happened. Otherwise you need to output some text - and that text should be localizable for humans - which means you need to write a whole boat load of code on your script to both parse the response and generate the outpu - ie a --machine-output=true flag) 
So 1 is not an error case and it is not for "forseeable errors" - its where the CLI wants to say Hey I ran successfully but (similar to grep foo bar when bar does not contain foo. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-26 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
I don't see an issue to start error return codes numbering in the above table from 2 if necessary. 
My intention is to have uniform issue handling/reporting from all CLI commands. I think the best way how we can do that is to throw appropriate exception (following above scheme) when it occurs and pass its handling/reporting to the CLICommand class itself. 
If we follow that every CLI command can on "foreseeable issue" return its own code (includes reporting), we can lost this benefit at all and return to the previous state. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-21 Thread ogon...@gmail.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Oliver Gondža edited a comment on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 I suggest to keep the cases when command is putting Jenkins into some state (computer offline, jenkins quieting down, job in view, etc.) while it already  it  is  in such state aside for now as I would like to see those idempotent and therefore return 0. (Unless we want to squeeze such change into this PR).I fail to come up with a definition of foreseeable failure class. Consider there is a client that calls Jenkins CLI internally, how would handling of such problems differ? 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-21 Thread ogon...@gmail.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Oliver Gondža commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
I suggest to keep the cases when command is putting Jenkins into some state (computer offline, jenkins quieting down, job in view, etc.) while it already it in such state aside for now as I would like to see those idempotent and therefore return 0. (Unless we want to squeeze such change into this PR). 
I fail to come up with a definition of foreseeable failure class. Consider there is a client that calls Jenkins CLI internally, how would handling of such problems differ? 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-21 Thread ogon...@gmail.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Oliver Gondža commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Jesse Glick, what would be foreseeable, nonexceptional “failure”? Incorrect command use? Permission? Entity does not exist/can not accept given operation? 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-21 Thread db...@cloudbees.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Daniel Beck commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
IMO: New name of renamed project taken. Name of created project taken. Quieting down but Jenkins is already. Node is already marked offline. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-21 Thread db...@cloudbees.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Daniel Beck commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 

I would like to see those idempotent and therefore return 0.
 
Good point. Still leaves creating/renaming a job when the name is already taken. Trying to get-job a job that does not exist. Etc. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-20 Thread jgl...@cloudbees.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Jesse Glick commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
IMO exit code 1 should be reserved for foreseeable, nonexceptional “failure”, with 2+ being used for true errors. See man grep for example. CC James Nord 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-20 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
PR for re-factored code sent. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-14 Thread dogf...@java.net (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 dogfood commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Integrated in  jenkins_2.0 #5 JENKINS-32273 Jenkins CLI unification of error handling and returning (Revision 253c2a6444ee9ce8503cea592e1f10a77d51f654) 
 Result = SUCCESS pjanouse : 253c2a6444ee9ce8503cea592e1f10a77d51f654 Files :  
 

core/src/main/java/hudson/cli/CLICommand.java
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-11 Thread scm_issue_l...@java.net (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 SCM/JIRA link daemon commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Code changed in jenkins User: Oliver Gondža Path: core/src/main/java/hudson/cli/CLICommand.java http://jenkins-ci.org/commit/jenkins/a7a8e3081e6bbb5886aad961a4a3b514ad3e73d5 Log: Merge pull request #1969 from pjanouse/JENKINS-32273 
JENKINS-32273 Jenkins CLI unification of error handling and returning 
Compare: https://github.com/jenkinsci/jenkins/compare/70edfcda1010...a7a8e3081e6b 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-11 Thread scm_issue_l...@java.net (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 SCM/JIRA link daemon commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Code changed in jenkins User: Ing. Pavel Janousek Path: core/src/main/java/hudson/cli/CLICommand.java http://jenkins-ci.org/commit/jenkins/253c2a6444ee9ce8503cea592e1f10a77d51f654 Log: JENKINS-32273 Jenkins CLI unification of error handling and returning 
Extended exception handling and logging in CLICommand 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-11 Thread dogf...@java.net (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 dogfood commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Integrated in  jenkins_main_trunk #4410 JENKINS-32273 Jenkins CLI unification of error handling and returning (Revision 253c2a6444ee9ce8503cea592e1f10a77d51f654) 
 Result = UNSTABLE pjanouse : 253c2a6444ee9ce8503cea592e1f10a77d51f654 Files :  
 

core/src/main/java/hudson/cli/CLICommand.java
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-11 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Jenkins /  JENKINS-32273 
 
 
 
  Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 

Change By:
 
 Pavel Janoušek 
 
 
 
 
 
 
 
 
 
 TL;DR;The aim of this JIRA is to start unification of an issue handling in CLI commands.Details:Currently there is a discrepancy between returned error codes if an issue occurred during execution. It depends on the fact whether the CLI command is implemented as {{@CLIMethod}} or extending {{hudson.cli.CLICommand}} class.{{@CLIMethod}} usually returns 1 in the case an issue occurred, similar situation in {{hudson.cli.CLICommand}} returns -1 to the shell.There is an ongoing effort to extract all CLI commands from the Core to CLI (see JENKINS-22969), so the discrepancy should be removed shortly and consistent error code definition should be set-up on one place only - in {{hudson.cli.CLICommand}}.Currently we should use this semantic in CLI:* 0 means All right* -1 means An error occurredTechnically anything else than zero means an issue occurred. Later we can use more precisely defined error codes for the different issues if useful.Update 07-Jan-2016 ({color:red}WIP{color}):TODO- Refactor core commands to use correct exception classes- Update javadoc for {{CLICommand#run}}- Unify the handling in {{CLIRegisterer}}Proposed a new unified scheme of exception raising, handling, reporting and error code returning:|| Exception name || Meaning || Correct usage || Incorrect usage || Processing || Return code ||| CmdLineException | Wrong parameter, input value can't be decoded etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L75] | * [AddJobToViewCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/AddJobToViewCommand.java#L58-L59] -> IllegalStateException \\* [ConsoleCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/ConsoleCommand.java#L53] -> IllegalArgumentException | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr \\* print usage help | 2 || IllegalStateException | Can't continue due to an incorrect state of Jenkins instance, job, build etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L58] \\comes from Jenkins.getActiveInstance() | none | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr | 4 || IllegalArgumentException | Can't continue due to wrong input parameter (job doesn't exist etc.) | [CopyJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CopyJobCommand.java#L66] | * [CreateJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CreateJobCommand.java#L67] -> IllegalStateException | * catch in CLICommand \\* print "\nERROR: " + cause message to stderr | 3 || AbortException | Can't continue due to an other (rare) issue \\Note: Current usage of this exception is wrong, usually there should be IllegalState or CmdLine exception raised instead of this | none | * [BuildCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/BuildCommand.java#L129] -> CmdLineException \\* 

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-08 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Jenkins /  JENKINS-32273 
 
 
 
  Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 

Change By:
 
 Pavel Janoušek 
 
 
 
 
 
 
 
 
 
 TL;DR;The aim of this JIRA is to start unification of an issue handling in CLI commands.Details:Currently there is a discrepancy between returned error codes if an issue occurred during execution. It depends on the fact whether the CLI command is implemented as {{@CLIMethod}} or extending {{hudson.cli.CLICommand}} class.{{@CLIMethod}} usually returns 1 in the case an issue occurred, similar situation in {{hudson.cli.CLICommand}} returns -1 to the shell.There is an ongoing effort to extract all CLI commands from the Core to CLI (see JENKINS-22969), so the discrepancy should be removed shortly and consistent error code definition should be set-up on one place only - in {{hudson.cli.CLICommand}}.Currently we should use this semantic in CLI:* 0 means All right* -1 means An error occurredTechnically anything else than zero means an issue occurred. Later we can use more precisely defined error codes for the different issues if useful.Update 07-Jan-2016 ({color:red}WIP{color}):TODO- Refactor core commands to use correct exception classes- Update javadoc for {{CLICommand#run}}- Unify the handling in {{CLIRegisterer}}Proposed a new unified scheme of exception raising, handling, reporting and error code returning:|| Exception name || Meaning || Correct usage || Incorrect usage || Processing || Return code ||| CmdLineException | Wrong parameter, input value can't be decoded etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L75] | * [AddJobToViewCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/AddJobToViewCommand.java#L58-L59] -> IllegalStateException \\* [ConsoleCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/ConsoleCommand.java#L53] -> IllegalArgumentException | * catch in CLICommand \\* print  "\nERROR: " +  cause message to stderr  \\* print usage help  |  -1  2  || IllegalStateException | Can't continue due to an incorrect state of Jenkins instance, job, build etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L58] \\comes from Jenkins.getActiveInstance() | none | * catch in CLICommand \\* print  "\nERROR: " +  cause message to stderr |  -1  4  || IllegalArgumentException | Can't continue due to wrong input parameter (job doesn't exist etc.) | [CopyJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CopyJobCommand.java#L66] | * [CreateJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CreateJobCommand.java#L67] -> IllegalStateException | * catch in CLICommand \\* print  "\nERROR: " +  cause message to stderr |  -1  3  || AbortException | Can't continue due to an other (rare) issue \\Note: Current usage of this exception is wrong, usually there should be IllegalState or CmdLine exception raised instead of this | none | * [BuildCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/BuildCommand.java#L129] -> CmdLineException \\* 

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-08 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Proposal updated - return codes and processing. 
@Martin I agree that that behavior is sufficient for most cases. On the other hand, there can be a case where more precise error code analysis is helpful. If someone can only detect if something went wrong, it can use "return code !=0" (or "return code > 0") _expression_ easily, but if we return 1 for most (probably all) error cases, additional effort on caller side would be needed - then a different error code would be welcomed. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-08 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek edited a comment on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 Proposal updated - return codes and processing.@MartinI agree that that behavior is sufficient for most cases. On the other hand, there can be a case where more precise error code analysis is helpful. If someone can only detect if something went wrong,  it  he  can use "return code !=0" (or "return code > 0") _expression_ easily, but if we return 1 for most (probably all) error cases, additional effort on caller side would be needed - then a different error code would be welcomed. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-07 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Jenkins /  JENKINS-32273 
 
 
 
  Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 

Change By:
 
 Pavel Janoušek 
 
 
 

Summary:
 
 Refactor  error return code(s)  and unify issue handling  in CLI commands 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-07 Thread ogon...@gmail.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Oliver Gondža updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Jenkins /  JENKINS-32273 
 
 
 
  Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 

Change By:
 
 Oliver Gondža 
 
 
 
 
 
 
 
 
 
 TL;DR;The aim of this JIRA is to start unification of an issue handling in CLI commands.Details:Currently there is a discrepancy between returned error codes if an issue occurred during execution. It depends on the fact whether the CLI command is implemented as {{@CLIMethod}} or extending {{hudson.cli.CLICommand}} class.{{@CLIMethod}} usually returns 1 in the case an issue occurred, similar situation in {{hudson.cli.CLICommand}} returns -1 to the shell.There is an ongoing effort to extract all CLI commands from the Core to CLI (see JENKINS-22969), so the discrepancy should be removed shortly and consistent error code definition should be set-up on one place only - in {{hudson.cli.CLICommand}}.Currently we should use this semantic in CLI:* 0 means All right* -1 means An error occurredTechnically anything else than zero means an issue occurred. Later we can use more precisely defined error codes for the different issues if useful.Update 07-Jan-2016 ({color:red}WIP{color}):TODO- Refactor core commands to use correct exception classes- Update javadoc for {{CLICommand#run}} - Unify the handling in {{CLIRegisterer}}   Proposed a new unified scheme of exception raising, handling, reporting and error code returning:|| Exception name || Meaning || Correct usage || Incorrect usage || Processing || Return code ||| CmdLineException | Wrong parameter, input value can't be decoded etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L75] | * [AddJobToViewCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/AddJobToViewCommand.java#L58-L59] -> IllegalStateException \\* [ConsoleCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/ConsoleCommand.java#L53] -> IllegalArgumentException | * catch in CLICommand \\* print cause message to stderr | -1 || IllegalStateException | Can't continue due to an incorrect state of Jenkins instance, job, build etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L58] \\comes from Jenkins.getActiveInstance() | none | * catch in CLICommand \\* print cause message to stderr | -1 || IllegalArgumentException | Can't continue due to wrong input parameter (job doesn't exist etc.) | [CopyJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CopyJobCommand.java#L66] | * [CreateJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CreateJobCommand.java#L67] -> IllegalStateException | * catch in CLICommand \\* print cause message to stderr | -1 || AbortException | Can't continue due to an other (rare) issue \\Note: Current usage of this exception is wrong, usually there should be IllegalState or CmdLine exception raised instead of this | none | * [BuildCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/BuildCommand.java#L129] -> CmdLineException \\* 

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-07 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek edited a comment on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 During the investigation I've realized the particular exception is used differently  (  in  completely different situation) in  the different CLI commands or the very similar situation/issue is reported by raising a different exception  class  in the different CLI commands.For that reason I've created a new proposal for the unified scheme how to handle an exceptional situation/state, which exception should be raised, how it should be processed, reported and which return code should be returned back to the shell. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-07 Thread ogon...@gmail.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Oliver Gondža updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Jenkins /  JENKINS-32273 
 
 
 
  Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 

Change By:
 
 Oliver Gondža 
 
 
 
 
 
 
 
 
 
 TL;DR;The aim of this JIRA is to start unification of an issue handling in CLI commands.Details:Currently there is a discrepancy between returned error codes if an issue occurred during execution. It depends on the fact whether the CLI command is implemented as {{@CLIMethod}} or extending {{hudson.cli.CLICommand}} class.{{@CLIMethod}} usually returns 1 in the case an issue occurred, similar situation in {{hudson.cli.CLICommand}} returns -1 to the shell.There is an ongoing effort to extract all CLI commands from the Core to CLI (see JENKINS-22969), so the discrepancy should be removed shortly and consistent error code definition should be set-up on one place only - in {{hudson.cli.CLICommand}}.Currently we should use this semantic in CLI:* 0 means All right* -1 means An error occurredTechnically anything else than zero means an issue occurred. Later we can use more precisely defined error codes for the different issues if useful.Update 07-Jan-2016 ({color:red}WIP{color}): TODO- Refactor core commands to use correct exception classes- Update javadoc for {{CLICommand#run}} Proposed a new unified scheme of exception raising, handling, reporting and error code returning:|| Exception name || Meaning || Correct usage || Incorrect usage || Processing || Return code ||| CmdLineException | Wrong parameter, input value can't be decoded etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L75] | * [AddJobToViewCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/AddJobToViewCommand.java#L58-L59] -> IllegalStateException \\* [ConsoleCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/ConsoleCommand.java#L53] -> IllegalArgumentException | * catch in CLICommand \\* print cause message to stderr | -1 || IllegalStateException | Can't continue due to an incorrect state of Jenkins instance, job, build etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L58] \\comes from Jenkins.getActiveInstance() | none | * catch in CLICommand \\* print cause message to stderr | -1 || IllegalArgumentException | Can't continue due to wrong input parameter (job doesn't exist etc.) | [CopyJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CopyJobCommand.java#L66] | * [CreateJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CreateJobCommand.java#L67] -> IllegalStateException | * catch in CLICommand \\* print cause message to stderr | -1 || AbortException | Can't continue due to an other (rare) issue \\Note: Current usage of this exception is wrong, usually there should be IllegalState or CmdLine exception raised instead of this | none | * [BuildCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/BuildCommand.java#L129] -> CmdLineException \\* [InstallToolCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/InstallToolCommand.java#L76] 

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-07 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Jenkins /  JENKINS-32273 
 
 
 
  Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 

Change By:
 
 Pavel Janoušek 
 
 
 
 
 
 
 
 
 
 TL;DR;The aim of this JIRA is to start unification of  error return codes from  an issue handling in  CLI commands.Details:Currently there is a discrepancy between returned error codes if an issue occurred during execution. It depends on the fact whether the CLI command is implemented as {{@CLIMethod}} or extending {{hudson.cli.CLICommand}} class.{{@CLIMethod}} usually returns 1 in the case an issue occurred, similar situation in {{hudson.cli.CLICommand}} returns -1 to the shell.There is an ongoing effort to extract all CLI commands from the Core to CLI (see JENKINS-22969), so the discrepancy should be removed shortly and consistent error code definition should be set-up on one place only - in {{hudson.cli.CLICommand}}.Currently we should use this semantic in CLI:* 0 means All right* -1 means An error occurredTechnically anything else than zero means an issue occurred. Later we can use more precisely defined error codes for the different issues if useful.Update 01-07-2016 ({color:red}WIP{color}):Proposed a new unified scheme of exception raising, handling, reporting and error code returning:|| Exaption name || Meaning || Correct usage || Incorrect ussage || Processing || Return code ||| CmdLineException | Wrong parameter, input value can't be decoded etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L75] | * [AddJobToViewCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/AddJobToViewCommand.java#L58-L59] -> IllegalStateException \\* [ConsoleCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/ConsoleCommand.java#L53] -> IllegalArgumentException | * catch in CLICommand \\* print cause message to stderr | -1 || IllegalStateException | Can't continue due to an incorrect state of Jenkins instance, job, build etc. | [CommandDuringBuild.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CommandDuringBuild.java#L58] | none | * catch in CLICommand \\* print cause message to stderr | -1 || IllegalArgumentException | Can't continue due to wrong input parameter (job doesn't exist etc.) | [CopyJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CopyJobCommand.java#L66] | * [CreateJobCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/CreateJobCommand.java#L67] -> IllegalStateException | * catch in CLICommand \\* print cause message to stderr | -1 || AbortException | Can't continue due to an other (rare) issue \\Note: Current usage of this exception is wrong, usually there should be IllegalState or CmdLine exception raised instead of this | none | * [BuildCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/BuildCommand.java#L129] -> CmdLineException \\* [InstallToolCommand.java|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/cli/InstallToolCommand.java#L76] -> IllegalArgumentException | * catch in CLICommand \\* print cause message to stderr | -1 || AccessDeniedException 

[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-07 Thread pjano...@redhat.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Pavel Janoušek commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
During the investigation I've realized the particular exception is used differently in the different CLI commands or the very similar situation/issue is reported by raising a different exception in the different CLI commands. 
For that reason I've created a new proposal for the unified scheme how to handle an exceptional situation/state, which exception should be raised, how it should be processed, reported and which return code should be returned back to the shell. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] [cli] (JENKINS-32273) Refactor and unify issue handling in CLI commands

2016-01-07 Thread db...@cloudbees.com (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Daniel Beck commented on  JENKINS-32273 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Refactor and unify issue handling in CLI commands  
 
 
 
 
 
 
 
 
 
 
Isn't -1 == 255? Typically error codes are in the low positive range… 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.