Skip to content

Commit

Permalink
Merge pull request #1 from agorapulse/chore/kordamp
Browse files Browse the repository at this point in the history
moved to kordamp
  • Loading branch information
musketyr authored Apr 13, 2021
2 parents 7a9ff59 + a15e64e commit c7bcb8e
Show file tree
Hide file tree
Showing 45 changed files with 947 additions and 286 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false

[*.yml]
# YAML should be space separated see https://en.wikipedia.org/wiki/YAML#Pitfalls_and_implementation_defects
indent_style = space
indent_size = 2
25 changes: 25 additions & 0 deletions .github/workflows/gradle-versions-watchdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Gradle RC Watchdog

on:
schedule:
- cron: '0 0 13 * *'

jobs:
check:
name: Verify the Latest Gradle Version
runs-on: ubuntu-latest
env:
GRADLE_OPTS: "-Xmx6g -Xms4g"
CI: true

steps:
- uses: actions/checkout@v1

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- uses: eskatos/gradle-command-action@v1
with:
arguments: check --stacktrace
gradle-version: rc
53 changes: 53 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2019-2021 Agorapulse.
#
# 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
#
# https://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.
#

name: Check

on: [push, pull_request]
jobs:
check:
name: Check
runs-on: ubuntu-latest
env:
GRADLE_OPTS: "-Xmx6g -Xms4g"
CI: true
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

steps:
- uses: actions/checkout@v1

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: eskatos/gradle-command-action@v1
with:
arguments: check coveralls --stacktrace
- name: Show Reports
uses: actions/upload-artifact@v1
if: failure()
with:
name: reports
path: build/reports/
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
release:
types: [published]
jobs:
release:
name: Release
runs-on: ubuntu-latest
env:
GRADLE_OPTS: "-Xmx6g -Xms4g"
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Semantic Version
id: version
uses: ncipollo/semantic-version-action@v1
- uses: eskatos/gradle-command-action@v1
with:
arguments: gitPublishPush bintrayUpload -PbintrayUsername=${{ secrets.BINTRAY_USER }} -PbintrayApiKey=${{ secrets.BINTRAY_KEY }} -Pversion=${{ steps.version.outputs.tag }} -Prelease=true -Dorg.ajoberstar.grgit.auth.username=${{ secrets.AGORAPULSE_BOT_PERSONAL_TOKEN }} --stacktrace
ping:
name: Notify Upstream Repositories
runs-on: ubuntu-latest
needs: [release]
strategy:
matrix:
repository:
- agorapulse/agorapulse-bom
steps:
- uses: actions/checkout@v1
- name: Semantic Version
id: version
uses: ncipollo/semantic-version-action@v1
- name: Dispatch to ${{ matrix.repository }}
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.AGORAPULSE_BOT_PERSONAL_TOKEN }}
repository: ${{ matrix.repository }}
event-type: ap-new-version-released-event
client-payload: '{ "group": "com.agorapulse", "module": "micronaut-rethrow", "version": "${{ steps.version.outputs.tag }}", "property" : "micronaut.rethrow.version", "github" : ${{ toJson(github) }} }'
28 changes: 19 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
Thumbs.db
.DS_Store
.gradle

# Gradle
build/
target/
out/
.idea
.gradle/

# IDEs

*.c9
*.iml
*.ipr
*.iws
.project
.settings
.classpath
*.vscode
.idea/
.asscache
MANIFEST.MF
out

# PAW
*.paw

# Redis
*.rdb

13 changes: 13 additions & 0 deletions .lazybones/stored-params.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#Lazybones saved template parameters
#Tue Apr 13 07:59:24 CEST 2021
name=Micronaut Rethrow
id=micronaut-rethrow
dev.name=Vladimir Orany
dev.id=musketyr
bintray.repo=libs
bintray.org=agorapulse
desc=Micronaut Rethrow Library
pkg=com.agorapulse.micronaut.rethrow
vendor=Agorapulse
group=com.agorapulse
org=agorapulse
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

4 changes: 0 additions & 4 deletions Dockerfile

This file was deleted.

70 changes: 6 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,11 @@
# Micronaut Rethrow

Simple around advice which catches errors of given type and rethrows them
as another type.
[![Build Status](https://github.com/agorapulse/micronaut-rethrow/workflows/Check/badge.svg)](https://github.com/agorapulse/micronaut-rethrow/actions)
[![Download](https://api.bintray.com/packages/agorapulse/libs/micronaut-rethrow/images/download.svg)](https://bintray.com/agorapulse/libs/micronaut-rethrow/_latestVersion)
[![Coverage Status](https://coveralls.io/repos/github/agorapulse/micronaut-rethrow/badge.svg?branch=master)](https://coveralls.io/github/agorapulse/micronaut-rethrow?branch=master)

## Installation
Micronaut Rethrow Library

```
repositories {
jcenter()
}
See [Full Documentation][DOCS]

dependencies {
compile 'com.agorapulse:micronaut-rethrow:0.1.0'
}
```

## Usage

Annotate a service method with the `@Rethrow` annotation to wrap the exceptions thrown inside the method
into a different one.

```java
@Singleton
public class MyService {

@Rethrow(
// rethrow exceptions as IllegalStateException
as = IllegalStateException.class,
// optional message
message = "Something wrong happened",
// optional filter
only = IllegalArgumentException.class
)
void doSomeWork() {
// throws IllegalArgumentException
}

// you can declare a function which does the conversion for you
// other annotations's properties are ingored in that case
@Rethrow(RethrowFuction.class)
void doOtherWork() {
// throws IllegalArgumentException
}

}

public class RethrowFunction implements Function<Throwable, RuntimeException> {

public RuntimeException apply(Throwable th) {
return new IllegalStateException("Rethrown using function", th);
}

}
```

If you are using Groovy code you can use `Closure` to declare the function:

```groovy
@Singleton
class OtherService {
@Rethrow({ new IllegalStateException(it)})
void doSomething() {
// exceptional code
}
}
```
[DOCS]: https://agorapulse.github.io/micronaut-rethrow
Loading

0 comments on commit c7bcb8e

Please sign in to comment.