-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expanded and centralized exception handling for connections (#109)
- Loading branch information
1 parent
adee57a
commit d254d56
Showing
9 changed files
with
1,079 additions
and
1,079 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
70 changes: 35 additions & 35 deletions
70
plugin/src/net/groboclown/idea/p4ic/server/exceptions/P4AccessException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
/* | ||
* 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 net.groboclown.idea.p4ic.server.exceptions; | ||
|
||
import com.perforce.p4java.exception.AccessException; | ||
import com.perforce.p4java.exception.P4JavaException; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class P4AccessException extends P4DisconnectedException { | ||
public P4AccessException(@NotNull String message) { | ||
super(message); | ||
} | ||
|
||
public P4AccessException(@NotNull AccessException cause) { | ||
super(cause); | ||
} | ||
|
||
public P4JavaException getP4JavaException() { | ||
if (getCause() != null && getCause() instanceof P4JavaException) { | ||
return (P4JavaException) getCause(); | ||
} | ||
return null; | ||
} | ||
} | ||
/* | ||
* 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 net.groboclown.idea.p4ic.server.exceptions; | ||
|
||
import com.perforce.p4java.exception.AccessException; | ||
import com.perforce.p4java.exception.P4JavaException; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class P4AccessException extends P4DisconnectedException { | ||
public P4AccessException(@NotNull String message) { | ||
super(message); | ||
} | ||
|
||
public P4AccessException(@NotNull AccessException cause) { | ||
super(cause); | ||
} | ||
|
||
public P4JavaException getP4JavaException() { | ||
if (getCause() != null && getCause() instanceof P4JavaException) { | ||
return (P4JavaException) getCause(); | ||
} | ||
return null; | ||
} | ||
} |
84 changes: 42 additions & 42 deletions
84
plugin/src/net/groboclown/idea/p4ic/server/exceptions/P4PasswordException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
/* | ||
* 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 net.groboclown.idea.p4ic.server.exceptions; | ||
|
||
import com.intellij.openapi.project.Project; | ||
import com.perforce.p4java.exception.P4JavaException; | ||
import net.groboclown.idea.p4ic.config.ServerConfig; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class P4PasswordException extends P4VcsConnectionException { | ||
public P4PasswordException(@NotNull String message) { | ||
super(message); | ||
} | ||
|
||
public P4PasswordException(@NotNull P4JavaException cause) { | ||
super(cause); | ||
} | ||
|
||
public P4PasswordException(@NotNull P4VcsConnectionException cause) { | ||
super(cause.getProject(), cause.getServerConfig(), cause); | ||
} | ||
|
||
public P4PasswordException(@Nullable Project project, @Nullable ServerConfig serverConfig, @NotNull String message) { | ||
super(project, serverConfig, message); | ||
} | ||
|
||
public P4PasswordException(@Nullable Project project, @Nullable ServerConfig serverConfig, @NotNull P4JavaException cause) { | ||
super(project, serverConfig, cause); | ||
} | ||
} | ||
/* | ||
* 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 net.groboclown.idea.p4ic.server.exceptions; | ||
|
||
import com.intellij.openapi.project.Project; | ||
import com.perforce.p4java.exception.P4JavaException; | ||
import net.groboclown.idea.p4ic.config.ServerConfig; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class P4PasswordException extends P4VcsConnectionException { | ||
public P4PasswordException(@NotNull String message) { | ||
super(message); | ||
} | ||
|
||
public P4PasswordException(@NotNull P4JavaException cause) { | ||
super(cause); | ||
} | ||
|
||
public P4PasswordException(@NotNull P4VcsConnectionException cause) { | ||
super(cause.getProject(), cause.getServerConfig(), cause); | ||
} | ||
|
||
public P4PasswordException(@Nullable Project project, @Nullable ServerConfig serverConfig, @NotNull String message) { | ||
super(project, serverConfig, message); | ||
} | ||
|
||
public P4PasswordException(@Nullable Project project, @Nullable ServerConfig serverConfig, @NotNull P4JavaException cause) { | ||
super(project, serverConfig, cause); | ||
} | ||
} |
98 changes: 49 additions & 49 deletions
98
plugin/src/net/groboclown/idea/p4ic/server/exceptions/P4RetryAuthenticationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
/* | ||
* 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 net.groboclown.idea.p4ic.server.exceptions; | ||
|
||
import com.intellij.openapi.project.Project; | ||
import com.perforce.p4java.exception.P4JavaException; | ||
import net.groboclown.idea.p4ic.config.ServerConfig; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class P4RetryAuthenticationException extends P4PasswordException { | ||
public P4RetryAuthenticationException(@NotNull String message) { | ||
super(message); | ||
} | ||
|
||
public P4RetryAuthenticationException(@NotNull P4JavaException cause) { | ||
super(cause); | ||
} | ||
|
||
public P4RetryAuthenticationException(@NotNull P4VcsConnectionException cause) { | ||
super(cause); | ||
} | ||
|
||
public P4RetryAuthenticationException(@Nullable Project project, @Nullable ServerConfig serverConfig, @NotNull String message) { | ||
super(project, serverConfig, message); | ||
} | ||
|
||
public P4RetryAuthenticationException(@Nullable Project project, @Nullable ServerConfig serverConfig, @NotNull P4JavaException cause) { | ||
super(project, serverConfig, cause); | ||
} | ||
|
||
public P4JavaException getP4JavaException() { | ||
if (getCause() != null && getCause() instanceof P4JavaException) { | ||
return (P4JavaException) getCause(); | ||
} | ||
return null; | ||
} | ||
} | ||
/* | ||
* 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 net.groboclown.idea.p4ic.server.exceptions; | ||
|
||
import com.intellij.openapi.project.Project; | ||
import com.perforce.p4java.exception.P4JavaException; | ||
import net.groboclown.idea.p4ic.config.ServerConfig; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class P4RetryAuthenticationException extends P4PasswordException { | ||
public P4RetryAuthenticationException(@NotNull String message) { | ||
super(message); | ||
} | ||
|
||
public P4RetryAuthenticationException(@NotNull P4JavaException cause) { | ||
super(cause); | ||
} | ||
|
||
public P4RetryAuthenticationException(@NotNull P4VcsConnectionException cause) { | ||
super(cause); | ||
} | ||
|
||
public P4RetryAuthenticationException(@Nullable Project project, @Nullable ServerConfig serverConfig, @NotNull String message) { | ||
super(project, serverConfig, message); | ||
} | ||
|
||
public P4RetryAuthenticationException(@Nullable Project project, @Nullable ServerConfig serverConfig, @NotNull P4JavaException cause) { | ||
super(project, serverConfig, cause); | ||
} | ||
|
||
public P4JavaException getP4JavaException() { | ||
if (getCause() != null && getCause() instanceof P4JavaException) { | ||
return (P4JavaException) getCause(); | ||
} | ||
return null; | ||
} | ||
} |
60 changes: 30 additions & 30 deletions
60
plugin/src/net/groboclown/idea/p4ic/server/exceptions/P4TimingException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
/* | ||
* 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 net.groboclown.idea.p4ic.server.exceptions; | ||
|
||
import com.intellij.openapi.vcs.VcsConnectionProblem; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class P4TimingException extends VcsConnectionProblem { | ||
public P4TimingException(@NotNull Throwable cause) { | ||
super(P4DisconnectedException.getMessageFor(cause)); | ||
initCause(cause); | ||
} | ||
|
||
|
||
@Override | ||
public boolean attemptQuickFix(boolean mayDisplayDialogs) { | ||
return false; | ||
} | ||
} | ||
/* | ||
* 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 net.groboclown.idea.p4ic.server.exceptions; | ||
|
||
import com.intellij.openapi.vcs.VcsConnectionProblem; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class P4TimingException extends VcsConnectionProblem { | ||
public P4TimingException(@NotNull Throwable cause) { | ||
super(P4DisconnectedException.getMessageFor(cause)); | ||
initCause(cause); | ||
} | ||
|
||
|
||
@Override | ||
public boolean attemptQuickFix(boolean mayDisplayDialogs) { | ||
return false; | ||
} | ||
} |
Oops, something went wrong.