Mapping "none" to an error in Effect Typescript library

Bombarding questions I know! I appreciate all your advice. What's the most elegant way to map an Option which is "none" to some kind of error? I can find ways but they seem overly verbose and I think there's probably a quick and easy way to do this

    yield* checkOriginURL(originUrl)
    const tokenStr = yield* ServerHelpers.extractTokenFromHeaders(request.headers) // convert NoSuchElement to a custom error ?
    const token = yield* ServerHelpers.extractToken(tokenStr)
Was this page helpful?