177 177 | pub fn message(&self) -> &str {
|
178 178 | &self.message
|
179 179 | }
|
180 180 | #[doc(hidden)]
|
181 181 | /// Returns the error name.
|
182 182 | pub fn name(&self) -> &'static str {
|
183 183 | "ValidationException"
|
184 184 | }
|
185 185 | }
|
186 186 | impl ::std::fmt::Display for ValidationException {
|
187 187 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
188 188 | ::std::write!(f, "ValidationException")?;
|
189 189 | {
|
190 190 | ::std::write!(f, ": {}", &self.message)?;
|
191 191 | }
|
192 192 | Ok(())
|
193 193 | }
|
194 194 | }
|
195 195 | impl ::std::error::Error for ValidationException {}
|
196 196 | impl ValidationException {
|
197 197 | /// Creates a new builder-style object to manufacture [`ValidationException`](crate::error::ValidationException).
|
198 198 | pub fn builder() -> crate::error::validation_exception::Builder {
|
199 199 | crate::error::validation_exception::Builder::default()
|
200 200 | }
|
201 201 | }
|
202 202 | /// See [`InternalServerError`](crate::error::InternalServerError).
|
203 203 | pub mod internal_server_error {
|
204 204 |
|
205 205 | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
206 206 | /// Holds one variant for each of the ways the builder can fail.
|
207 - |
|
208 207 | #[allow(clippy::enum_variant_names)]
|
209 208 | pub enum ConstraintViolation {
|
210 209 | /// `message` was not provided but it is required when building `InternalServerError`.
|
211 210 | MissingMessage,
|
212 211 | }
|
213 212 | impl ::std::fmt::Display for ConstraintViolation {
|
214 213 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
215 214 | match self {
|
216 215 | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `InternalServerError`"),
|
217 216 | }
|
218 217 | }
|
219 218 | }
|
220 219 | impl ::std::error::Error for ConstraintViolation {}
|
221 220 | impl ::std::convert::TryFrom<Builder> for crate::error::InternalServerError {
|
222 221 | type Error = ConstraintViolation;
|
223 222 |
|
224 223 | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
225 224 | builder.build()
|
226 225 | }
|
227 226 | }
|
228 227 | /// A builder for [`InternalServerError`](crate::error::InternalServerError).
|
229 228 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
230 229 | pub struct Builder {
|
231 230 | pub(crate) message: ::std::option::Option<::std::string::String>,
|
232 231 | }
|
233 232 | impl Builder {
|
234 233 | #[allow(missing_docs)] // documentation missing in model
|
235 234 | pub fn message(mut self, input: ::std::string::String) -> Self {
|
236 235 | self.message = Some(input);
|
237 236 | self
|
238 237 | }
|
239 238 | /// Consumes the builder and constructs a [`InternalServerError`](crate::error::InternalServerError).
|
240 239 | ///
|
241 240 | /// The builder fails to construct a [`InternalServerError`](crate::error::InternalServerError) if you do not provide a value for all non-`Option`al members.
|
242 241 | ///
|
243 242 | pub fn build(self) -> Result<crate::error::InternalServerError, ConstraintViolation> {
|
244 243 | self.build_enforcing_required_and_enum_traits()
|
245 244 | }
|
246 245 | fn build_enforcing_required_and_enum_traits(
|
247 246 | self,
|
248 247 | ) -> Result<crate::error::InternalServerError, ConstraintViolation> {
|
249 248 | Ok(crate::error::InternalServerError {
|
250 249 | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
251 250 | })
|
252 251 | }
|
253 252 | }
|
254 253 | }
|
255 254 | /// See [`ValidationException`](crate::error::ValidationException).
|
256 255 | pub mod validation_exception {
|
257 256 |
|
258 257 | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
259 258 | /// Holds one variant for each of the ways the builder can fail.
|
260 - |
|
261 259 | #[allow(clippy::enum_variant_names)]
|
262 260 | pub enum ConstraintViolation {
|
263 261 | /// `message` was not provided but it is required when building `ValidationException`.
|
264 262 | MissingMessage,
|
265 263 | }
|
266 264 | impl ::std::fmt::Display for ConstraintViolation {
|
267 265 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
268 266 | match self {
|
269 267 | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationException`"),
|
270 268 | }
|
271 269 | }
|
272 270 | }
|
273 271 | impl ::std::error::Error for ConstraintViolation {}
|
274 272 | impl ::std::convert::TryFrom<Builder> for crate::error::ValidationException {
|
275 273 | type Error = ConstraintViolation;
|
276 274 |
|
277 275 | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
278 276 | builder.build()
|
279 277 | }
|
280 278 | }
|
281 279 | /// A builder for [`ValidationException`](crate::error::ValidationException).
|
282 280 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
283 281 | pub struct Builder {
|
284 282 | pub(crate) message: ::std::option::Option<::std::string::String>,
|
285 283 | pub(crate) field_list:
|
286 284 | ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
|
287 285 | }
|
288 286 | impl Builder {
|
289 287 | /// A summary of the validation failure.
|
290 288 | pub fn message(mut self, input: ::std::string::String) -> Self {
|