Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

kaliber-scala/jira-exception-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Error reporting to Jira with fallback to email for Play

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages