Skip to content

Commit

Permalink
Expanded and centralized exception handling for connections (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
groboclown committed Mar 30, 2016
1 parent adee57a commit d254d56
Show file tree
Hide file tree
Showing 9 changed files with 1,079 additions and 1,079 deletions.
468 changes: 234 additions & 234 deletions plugin/META-INF/plugin.xml

Large diffs are not rendered by default.

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;
}
}
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);
}
}
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;
}
}
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;
}
}
Loading

0 comments on commit d254d56

Please sign in to comment.