jira-exception-processor


License

License

MIT
Categories

Categories

Net
GroupId

GroupId

net.kaliber
ArtifactId

ArtifactId

jira-exception-processor_2.11
Last Version

Last Version

5.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

jira-exception-processor
jira-exception-processor
Project URL

Project URL

https://github.com/kaliber-scala/jira-exception-processor
Project Organization

Project Organization

net.kaliber
Source Code Management

Source Code Management

https://github.com/kaliber-scala/jira-exception-processor

Download jira-exception-processor_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/net.kaliber/jira-exception-processor_2.11/ -->
<dependency>
    <groupId>net.kaliber</groupId>
    <artifactId>jira-exception-processor_2.11</artifactId>
    <version>5.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.kaliber/jira-exception-processor_2.11/
implementation 'net.kaliber:jira-exception-processor_2.11:5.0.0'
// https://jarcasting.com/artifacts/net.kaliber/jira-exception-processor_2.11/
implementation ("net.kaliber:jira-exception-processor_2.11:5.0.0")
'net.kaliber:jira-exception-processor_2.11:jar:5.0.0'
<dependency org="net.kaliber" name="jira-exception-processor_2.11" rev="5.0.0">
  <artifact name="jira-exception-processor_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.kaliber', module='jira-exception-processor_2.11', version='5.0.0')
)
libraryDependencies += "net.kaliber" % "jira-exception-processor_2.11" % "5.0.0"
[net.kaliber/jira-exception-processor_2.11 "5.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.8
net.kaliber : scala-mailer-core_2.11 jar 6.0.1

provided (2)

Group / Artifact Type Version
com.typesafe : config jar 1.3.1
com.typesafe.play : play-ws_2.11 jar 2.5.8

test (2)

Group / Artifact Type Version
com.typesafe.play : play-test_2.11 jar 2.5.8
org.specs2 : specs2-core_2.11 jar 3.8.4

Project Modules

There are no modules declared in this project.

Jira exception processor module for Play 2.5.x

This module is created for internal use. If there is any interest in this feature for play, please contact us so we can make it more portable.

Installation

In the build.sbt file add the following lines:

libraryDependencies += "net.kaliber" %% "jira-exception-processor" % "5.0.0"

Configuration

In the application.conf file add the following pieces of information:

# Jira information, needed to report the errors to Jira
jira.username=username
jira.password="password"
jira.endpoint="https://organisation.atlassian.net/rest/api/2/"

# Information needed by the exception processor
jira.exceptionProcessor.enabled=true
jira.exceptionProcessor.projectKey=PA
jira.exceptionProcessor.componentName=tests
# Hash is the default
#jira.exceptionProcessor.hashCustomFieldName=Hash
#jira.exceptionProcessor.hashCustomFieldType=UUID
# 1 is the default (Bug)
#jira.exceptionProcessor.issueType=1

# Used when the connection to Jira failed, note that the error is also logged
jira.exceptionProcessor.mail.from.name=Play application
jira.exceptionProcessor.mail.from.address="[email protected]"
jira.exceptionProcessor.mail.to.name=Play
jira.exceptionProcessor.mail.to.address="[email protected]"

# Used by the SES plugin
mail.failTo="[email protected]"

mail.host=email-smtp.us-east-1.amazonaws.com
mail.port=465
mail.username="username"
mail.password="password"

# Process exceptions from the actor system
akka.actor.guardian-supervisor-strategy = "net.kaliber.jiraExceptionProcessor.ReportingSupervisorStrategy"

Usage

The actual usage depends on the strategy you are using for creating applications.

{
  val typesafeConfig = playConfiguration.underlying

  val jiraExceptionProcessor =
    new JiraExceptionProcessor(wsClient, 
    JiraExceptionProcessorSettings.fromConfig(typesafeConfig))

  def onError(request:RequestHeader, ex:Throwable) =
    jiraExceptionProcessor.reportError(request, ex)
}

You can also report custom errors:

jiraExceptionProcessor.reportError(ErrorInformation("summary", "description", "comment"))
jiraExceptionProcessor.reportError(ErrorInformation(throwable, "comment"))

Testing

In order to test put a JIRA endpoint and credentials in /src/test/resources/conf/overrides.conf:

jira.username="xxx"
jira.password="yyy"
jira.endpoint="https://zzz.atlassian.net/rest/api/2/"

Note that this file is present in .gitignore in order to prevent credentials from ending up in Github.

You can use DevNull SMTP to test the emails.

net.kaliber

Kaliber Scala

Open Source Scala Libraries

Versions

Version
5.0.0