Browse Source
Starting with removing a package cycle on the use of ResponseStatusException in the codec package, this commit generally refines codec exception handling. The new [Encoding|Decoding]Exception mirror the existing HttpMessageNot[Readable|Writable]Exception and are used similarly especially to differentiate betwen 400 and 500 errors when parsing server request body content. The commit also aligns some of the exception handling of JSON and XML on the WebFlux side with that on the Spring MVC side. Issue: SPR-15516pull/1418/head
12 changed files with 147 additions and 87 deletions
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
/* |
||||
* Copyright 2002-2017 the original author or authors. |
||||
* |
||||
* 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 org.springframework.core.codec; |
||||
|
||||
/** |
||||
* Indicates an issue with decoding the input stream with the focus on indicating |
||||
* a content issue such as a parse failure. As opposed to a more general I/O |
||||
* errors, illegal state, or a {@link CodecException} such as a configuration |
||||
* issue that a {@link Decoder} may choose to raise. |
||||
* |
||||
* <p>For example in a web application, a server side {@code DecodingException} |
||||
* would translate to a response with a 400 (bad input) status while |
||||
* {@code CodecException} would translate to 500 (server error) status. |
||||
* |
||||
* @author Rossen Stoyanchev |
||||
* @since 5.0 |
||||
* @see Decoder |
||||
*/ |
||||
@SuppressWarnings("serial") |
||||
public class DecodingException extends CodecException { |
||||
|
||||
/** |
||||
* Create a new DecodingException. |
||||
* @param msg the detail message |
||||
*/ |
||||
public DecodingException(String msg) { |
||||
super(msg); |
||||
} |
||||
|
||||
/** |
||||
* Create a new DecodingException. |
||||
* @param msg the detail message |
||||
* @param cause root cause for the exception, if any |
||||
*/ |
||||
public DecodingException(String msg, Throwable cause) { |
||||
super(msg, cause); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue