Add generic OpenVidu exception

pull/431/head
Rafael Renan Pacheco 2020-04-14 16:34:34 -03:00
parent 60a414c791
commit 2fe2cbf9c4
7 changed files with 60 additions and 3 deletions

2
.gitignore vendored
View File

@ -4,8 +4,10 @@
/target /target
.classpath .classpath
.idea
.project .project
.settings .settings
*.iml
*orig *orig
.springBeans .springBeans
*tmp/ *tmp/

View File

@ -10,7 +10,7 @@
</parent> </parent>
<artifactId>openvidu-java-client</artifactId> <artifactId>openvidu-java-client</artifactId>
<version>2.12.1</version> <version>2.13.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>OpenVidu Java Client</name> <name>OpenVidu Java Client</name>

View File

@ -0,0 +1,33 @@
/*
* (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
*
* 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 io.openvidu.java.client;
/**
* Defines a generic OpenVidu exception
*/
public class OpenViduException extends Exception {
protected OpenViduException(String message) {
super(message);
}
protected OpenViduException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -20,7 +20,7 @@ package io.openvidu.java.client;
/** /**
* Defines error responses from OpenVidu Server * Defines error responses from OpenVidu Server
*/ */
public class OpenViduHttpException extends Exception { public class OpenViduHttpException extends OpenViduException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private int status; private int status;

View File

@ -20,7 +20,7 @@ package io.openvidu.java.client;
/** /**
* Defines unexpected internal errors in OpenVidu Java Client * Defines unexpected internal errors in OpenVidu Java Client
*/ */
public class OpenViduJavaClientException extends Exception { public class OpenViduJavaClientException extends OpenViduException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -0,0 +1,11 @@
package io.openvidu.java.client;
import org.junit.Test;
public class OpenViduHttpExceptionTest {
@Test(expected = OpenViduException.class)
public void shouldThrowGenericOpenViduException() throws OpenViduHttpException {
throw new OpenViduHttpException(401);
}
}

View File

@ -0,0 +1,11 @@
package io.openvidu.java.client;
import org.junit.Test;
public class OpenViduJavaClientExceptionTest {
@Test(expected = OpenViduException.class)
public void shouldThrowGenericOpenViduException() throws OpenViduJavaClientException {
throw new OpenViduJavaClientException("message");
}
}