Merge pull request #431 from rafaelrenanpacheco/common-exception

Add generic OpenViduException
pull/437/head
Pablo Fuente Pérez 2020-04-15 11:28:39 +02:00 committed by GitHub
commit 0556033cc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 2 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

@ -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");
}
}