github.com/hernad/nomad@v1.6.112/ui/app/utils/notify-forbidden.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  // An error handler to provide to a promise catch to set a
     7  // forbidden flag on the route
     8  import codesForError from './codes-for-error';
     9  export default function notifyForbidden(route) {
    10    return (error) => {
    11      if (codesForError(error).includes('403')) {
    12        route.set('isForbidden', true);
    13      } else {
    14        throw error;
    15      }
    16    };
    17  }