Streamlining Error Mapping in Effect with mapTags
Does Effect have something like mapTags So I don't have to do something as awful as this?
Effect.mapError((x) => {
if (x._tag === "DatabaseError") {
return HttpError.internalServerError("Database error");
}
const message =
x._tag === "ExpiredToken"
? "Token expired"
: x._tag == "ParseError"
? `Expected apiKey (query) api key`
: "Invalid token";
return HttpError.unauthorized(message);
})