Skip to content

Commit

Permalink
Merge branch 'release/4.5.11.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
guss77 committed Nov 17, 2024
2 parents df6f079 + 4e97a26 commit c61cc35
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ stages:
variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2"

image: maven:3-jdk-11

cache:
paths:
- .m2/
Expand Down Expand Up @@ -35,7 +37,6 @@ package:
- target/*

maven-repo:
image: maven:3-jdk-11
stage: build
needs: [ package ]
script:
Expand All @@ -45,7 +46,6 @@ maven-repo:

ossrh:
stage: deploy
image: maven:3-jdk-11
only:
- tags
script:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ ported to all releases.

## Installation

Irked is available from the [Maven Central Repository](https://central.sonatype.com/artifact/tech.greenfield/irked-vertx/4.5.11.2).
Irked is available from the [Maven Central Repository](https://central.sonatype.com/artifact/tech.greenfield/irked-vertx/4.5.11.3).

If using Maven, add Irked as a dependency in your `pom.xml` file:

```xml
<dependency>
<groupId>tech.greenfield</groupId>
<artifactId>irked-vertx</artifactId>
<version>4.5.11.2</version>
<version>4.5.11.3</version>
</dependency>
```

For other build tools, see the Maven Central website for the syntax, but it generally
boils down to just using `tech.greenfield:irked-vertx:4.5.11.2` as the dependency string.
boils down to just using `tech.greenfield:irked-vertx:4.5.11.3` as the dependency string.

## Quick Start

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>tech.greenfield</groupId>
<artifactId>irked-vertx</artifactId>
<version>4.5.11.2</version>
<version>4.5.11.3</version>
<packaging>jar</packaging>
<name>irked-vertx</name>
<description>Opinionated framework for vertx-web route configuration and dispatch</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.fasterxml.jackson.core.JsonLocation;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonMappingException.Reference;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;

import io.vertx.core.json.DecodeException;
Expand All @@ -16,11 +18,24 @@ public static String formatFriendlyErrorMessage(DecodeException e) {
var cause = e.getCause();
if (cause instanceof UnrecognizedPropertyException)
return formatUnrecognizedPropertyMessage((UnrecognizedPropertyException)cause);
if (cause instanceof InvalidFormatException)
return formatInvalidFormatMessage((InvalidFormatException)cause);
if (cause instanceof JsonMappingException)
return formatJsonMappingMessage((JsonMappingException)cause);
return "Unexpected JSON decoding problem: " + e.getMessage();
}

public static String formatInvalidFormatMessage(InvalidFormatException e) {
var target = e.getTargetType();
var field = e.getPath().stream().reduce((a,b) -> b).map(r -> r.getFieldName()).orElse("UNKNOWN");
if (target.isEnum())
return String.format("Value '%s' is not one of the supported values for '%s', out of: %s %s", e.getValue(),
field, Stream.of(target.getEnumConstants()).map(Object::toString).collect(Collectors.joining(", ")),
describeLocation(e.getPath(), e.getLocation()));
return String.format("Value '%s' is a valid value for '' %s", e.getValue(), field,
describeLocation(e.getPath(), e.getLocation()));
}

public static String formatJsonMappingMessage(JsonMappingException e) {
return String.format("%s %s", e.getOriginalMessage(), describeLocation(e.getPath(), e.getLocation()));

Expand Down

0 comments on commit c61cc35

Please sign in to comment.