romariolopezc/elm-sentry/1.0.0

Renamed to rlopzc/elm-sentry. It is published under that name, and new versions come out there.

Versions published as romariolopezc/elm-sentry still install under that name. 1 version of 1 come from the new location (see their notes).

Rerouted (cache, verified). The original is gone. This copy comes from a Lamdera package cache made before it went. The Lamdera package server serves a copy recovered from a Lamdera package cache from 2021-02-13.

What we checked: Rebuilt from the unpacked sources in a Lamdera package cache (5 copies agree), which Elm only writes after the published SHA-1 checked out; elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip is our own, so its SHA-1 is not the published one.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/romariolopezc/elm-sentry/zipball/1.0.0/

Sentry

Sentry SDK

Types

type alias Sentry =
{ fatal : String -> Dict String Value -> Task Error UUID
, error : String -> Dict String Value -> Task Error UUID
, warning : String -> Dict String Value -> Task Error UUID
, info : String -> Dict String Value -> Task Error UUID
, debug : String -> Dict String Value -> Task Error UUID
}

Record that contains functions to report errors by Level.

Create one using withContext.

type Level
= Fatal
| Error
| Warning
| Info
| Debug

The event severity.

type Config

The configuration of the SDK.

Specifies the Public Key, the Host, and the Project ID.

Create one using config.

{ publicKey : String
, host : String
, projectId : String
}
-> Config

Creates a Config.

Use the dsn to provide the publicKey, host and projectId.

The @ character in the DSN separates the PublicKey and the Host.

-- DSN: https://[email protected]/2312456
--                      ^ PublicKey                       ^ Host           ^ ProjectId
Sentry.config
    { publicKey = "1900942c246350fdacb4c9369cac2ets"
    , host = "o298593.ingest.sentry.io"
    , projectId = "2312456"
    }

The environment name, such as "production" or "staging".

Create one using environment.

Create an Environment.

Sentry.environment "production"
type Context

The Context, for example, the Page name.

Crate one using context.

context : String -> Context

Create a Context.

Sentry.context "profile/settings"

The release version of the application.

This value can be a git SHA, or a product identifier with a semantic version.

Create one using releaseVersion.

Create a ReleaseVersion.

Sentry.releaseVersion "721e41770371db95eee98ca2707686226b993eda"

Reporting errors

-> Level
-> String
-> Dict String Value
-> Task Error UUID

Send an error to Sentry.

Normally, it's preferable to use withContext as it provides a reusable configured Sentry.

Arguments:

  • Config: The configuration about your Sentry team and project. Create one using config
  • Level: The severity of the error, e.g. Fatal, Error, Info
  • ReleaseVersion: Your app version. Can be a git commit SHA.
  • Environment: e.g. "production", "staging"
  • Context: Scopes the message. It can be the name of the Page that produced this error, e.g. "profile/settings"
  • String: The error message, e.g. "Backend on fire!"
  • Dict String Value: Extra information, e.g. {"response": "503 Service unavailable"}

On success, the Task will resolve to a UUID that was sent to Sentry as the Event ID.

On failure, the Http.Error will hold the information about the problem.

withContext : Config -> ReleaseVersion -> Environment -> String -> Sentry

Build a Sentry record configured with the given Config, ReleaseVersion, an Environment and a Context string.

    import Sentry exposing (Sentry)


    config : Sentry.Config
    config =
        Sentry.config
            { publicKey = "1900942c246350fdacb4c9369cac2ets"
            , host = "o298593.ingest.sentry.io"
            , projectId = "2312456"
            }


    releaseVersion : Sentry.ReleaseVersion
    releaseVersion =
        Sentry.releaseVersion "721e41770371db95eee98ca2707686226b993eda"


    environment : Sentry.Environment
    environment =
        Sentry.environment "production"


    sentry : Sentry
    sentry =
        Sentry.withContext config releaseVersion environment "profile/settings"


    sentry.fatal "Backend on fire!" (Dict.fromList [("response", toString response)])
    sentry.debug "Testing sentry integration" Dict.empty
    sentry.info "Backend timeout when saving the profile settings" Dict.empty