mirror of
https://github.com/fankes/moshi.git
synced 2025-10-18 23:49:21 +08:00
Convert exceptions to Kotlin (#1483)
* Rename .java to .kt * Convert exceptions to kotlin * Add missing empty constructor
This commit is contained in:
@@ -13,34 +13,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.squareup.moshi;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
package com.squareup.moshi
|
||||
|
||||
/**
|
||||
* Thrown when the data in a JSON document doesn't match the data expected by the caller. For
|
||||
* example, suppose the application expects a boolean but the JSON document contains a string. When
|
||||
* the call to {@link JsonReader#nextBoolean} is made, a {@code JsonDataException} is thrown.
|
||||
* the call to [JsonReader.nextBoolean] is made, a `JsonDataException` is thrown.
|
||||
*
|
||||
* <p>Exceptions of this type should be fixed by either changing the application code to accept the
|
||||
* Exceptions of this type should be fixed by either changing the application code to accept the
|
||||
* unexpected JSON, or by changing the JSON to conform to the application's expectations.
|
||||
*
|
||||
* <p>This exception may also be triggered if a document's nesting exceeds 31 levels. This depth is
|
||||
* This exception may also be triggered if a document's nesting exceeds 31 levels. This depth is
|
||||
* sufficient for all practical applications, but shallow enough to avoid uglier failures like
|
||||
* {@link StackOverflowError}.
|
||||
* [StackOverflowError].
|
||||
*/
|
||||
public final class JsonDataException extends RuntimeException {
|
||||
public JsonDataException() {}
|
||||
|
||||
public JsonDataException(@Nullable String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public JsonDataException(@Nullable Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public JsonDataException(@Nullable String message, @Nullable Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
public class JsonDataException : RuntimeException {
|
||||
public constructor() : super()
|
||||
public constructor(message: String?) : super(message)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
}
|
@@ -13,14 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.squareup.moshi;
|
||||
package com.squareup.moshi
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException
|
||||
|
||||
/** Thrown when the data being parsed is not encoded as valid JSON. */
|
||||
public final class JsonEncodingException extends IOException {
|
||||
public JsonEncodingException(@Nullable String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
public class JsonEncodingException(message: String?) : IOException(message)
|
Reference in New Issue
Block a user