iwf
    Preparing search index...

    Function mapAPIError

    • Maps MediaWiki API error codes to typed errors

      Parameters

      • apiErrorCode: string

        The MediaWiki API error code

      • message: string

        The error message

      • Optionaldetails: Record<string, unknown>

        Additional error details

        • wiki

          The wiki where the error occurred

        • title

          The title related to the error

      Returns IWFError

      The mapped IWFError instance

      const error = mapAPIError('notloggedin', 'User is not logged in', { wiki: 'enwiki' });
      // error is an instance of NotLoggedInError