File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ object App extends cask.MainRoutes:
150150 yield ()
151151 result.fold(
152152 errorMsg =>
153- scribe.error(errorMsg); cask.Response (errorMsg)
153+ scribe.error(errorMsg); cask.Response (errorMsg, statusCode = 500 )
154154 ,
155155 _ => cask.Response (" OK - Event processed successfully" )
156156 )
Original file line number Diff line number Diff line change 11import io .circe .syntax .*
22import io .circe .{ Decoder , Encoder }
33import sttp .client4 .*
4+ import sttp .client4 .ResponseException .UnexpectedStatusCode
45import sttp .client4 .circe .*
56
67object Grafana :
@@ -35,6 +36,11 @@ object Grafana:
3536 .response(asJson[GrafanaMessageResponse ])
3637 .send(backend)
3738 .body
39+ .left.flatMap {
40+ case e : UnexpectedStatusCode [? ] if e.body.toString.contains(" User is already added to this team" ) =>
41+ Right (GrafanaMessageResponse (" User is already added to this team" ))
42+ case e => Left (e)
43+ }
3844
3945case class GrafanaOrgResponse (id : Int , name : String ) derives Decoder
4046
You can’t perform that action at this time.
0 commit comments