Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsError extractors #505

Merged
merged 1 commit into from
Sep 8, 2020

Conversation

cchantep
Copy link
Member

Pull Request Checklist

Purpose

Easier/safer pattern matching on JsError:

import play.api.libs.json.JsError

def msg(err: JsError): Option[String] = err match {
  case JsError.Message(msg) => Some(msg)
  case _ => None
}

def cause(err: JsError): Option[(String, Exception)] = err match {
  case JsError.Detailed(msg, ex: Exception) => Some(msg -> ex)
  case _ => None
}

@cchantep cchantep force-pushed the feature/error-extractors branch from 8de8150 to a569033 Compare August 21, 2020 14:07
@ennru
Copy link
Contributor

ennru commented Sep 8, 2020

Close/open to get Travis started on this.

@ennru ennru closed this Sep 8, 2020
@ennru ennru reopened this Sep 8, 2020
@cchantep
Copy link
Member Author

cchantep commented Sep 8, 2020

Close/open to get Travis started on this.

Travis really doesn't seem stable these days ...

Copy link
Contributor

@ennru ennru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!
LGTM.

@cchantep
Copy link
Member Author

cchantep commented Sep 8, 2020

Thx @ennru

@cchantep cchantep merged commit cd9ae12 into playframework:master Sep 8, 2020
@cchantep cchantep deleted the feature/error-extractors branch September 8, 2020 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants