@mica/sdk (SDK contract v1)
    Preparing search index...

    Function messageOf

    The message to show a player for something that was thrown.

    The second half of MICA-172's widening, and public for a narrower reason than focusTrap: an add-on cannot avoid catching. Every useService(id).call(...) can reject, useAppAction hands a thrown value straight to a toast, and catch in TypeScript gives you unknown — so the add-on author writes err.message, which throws a second time inside the catch the first time a string or a null arrives instead of an Error. Four SDK modules already route through this for that reason (lazyBadge, ReportDialog, and both appAction facet twins); the fifth caller was always going to be an add-on.

    Takes the fallback as a required argument rather than defaulting one. There is no generic message worth showing a player, and a default would put "Something went wrong" into every add-on that forgot to think about it.

    • The message to show a player for something that was thrown.

      Five places wrote e?.message || 'something went wrong' by hand, typing the catch as any to do it, and two of them wrote e.message — which throws a second time inside the catch if what arrived was a string or null. catch gives you unknown because anything at all can be thrown, and that is worth honoring in the one place that has to deal with it.

      Parameters

      • error: unknown
      • fallback: string

      Returns string