summaryrefslogtreecommitdiff
path: root/android/os/ServiceSpecificException.java
blob: 3e0f6dae04d8bb2fd49e2cb231452560101f1d2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * 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 android.os;

/**
 * An exception specific to a service.
 *
 * <p>This exception includes an error code specific to the throwing
 * service.  This is mostly used by system services to indicate
 * domain specific error conditions.</p>
 *
 * <p>Since these exceptions are designed to be passed through Binder
 * interfaces, and to be generated by native-code Binder services,
 * they do not support exception chaining.</p>
 *
 * @hide
 */
public class ServiceSpecificException extends RuntimeException {
    public final int errorCode;

    public ServiceSpecificException(int errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }

    public ServiceSpecificException(int errorCode) {
        this.errorCode = errorCode;
    }

    @Override
    public String toString() {
        return super.toString() + " (code " + errorCode + ")";
    }
}