Skip to content

ErrorMsg - User Do not have the permission on the page#1256

Merged
anurag91jain merged 4 commits intodevfrom
NoAccess_App_msg
Jun 10, 2025
Merged

ErrorMsg - User Do not have the permission on the page#1256
anurag91jain merged 4 commits intodevfrom
NoAccess_App_msg

Conversation

@ammb-123
Copy link
Copy Markdown
Contributor

@ammb-123 ammb-123 commented Jun 4, 2025

Description

ErrorMsg - User Do not have the permission on the page

Changes Made

Added the Error code with message in the UI code

How to Test

1.Login in to the AI core application
2.Access required application
3.Error message will be populated if user not an Author,Owner,or ReadOnlyPermission

Notes

Uploading Errormsg.docx…

@ammb-123 ammb-123 requested a review from a team as a code owner June 4, 2025 14:20
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 4, 2025

@CodiumAI-Agent /describe

@QodoAI-Agent
Copy link
Copy Markdown

Title

ErrorMsg - User Do not have the permission on the page


User description

Description

ErrorMsg - User Do not have the permission on the page

Changes Made

Added the Error code with message in the UI code

How to Test

1.Login in to the AI core application
2.Access required application
3.Error message will be populated if user not an Author,Owner,or ReadOnlyPermission

Notes

Uploading Errormsg.docx…


PR Type

Bug fix


Description

  • Relay backend error message on API failure

  • Add 401-specific permission error handling

  • Provide generic fallback for no response


Changes walkthrough 📝

Relevant files
Error handling
monolith.store.ts
Enhanced permission API error handling                                     

packages/client/src/stores/monolith/monolith.store.ts

  • Added .catch() to axios GET call
  • Throw backend errorMessage from response
  • New 401 status check for permission denial
  • Fallback generic error for missing response
  • +7/-1     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link
    Copy Markdown

    github-actions bot commented Jun 4, 2025

    @CodiumAI-Agent /review

    @QodoAI-Agent
    Copy link
    Copy Markdown

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Error handling

    Using await with .catch without a surrounding try/catch makes the code after the await unreachable when the catch throws, preventing further logic from executing.

    }).catch((error) => {
            throw Error(error.response?.data?.errorMessage);
    });
    Null reference

    The if (!response) check is followed by accessing response.status, which will cause a runtime error if response is undefined.

    if (!response) {
        if (response.status === 401) {
            throw Error('User does not have access to this project');

    @github-actions
    Copy link
    Copy Markdown

    github-actions bot commented Jun 4, 2025

    @CodiumAI-Agent /improve

    @QodoAI-Agent
    Copy link
    Copy Markdown

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Remove invalid nested status check

    Remove the nested status check inside if (!response) since response is null and
    accessing response.status causes a runtime error. Simplify the block to only throw
    when there truly is no response.

    packages/client/src/stores/monolith/monolith.store.ts [1899-1905]

     if (!response) {
    -    if (response.status === 401) {
    -        throw Error('User does not have access to this project');
    -    } else {
    -        throw Error('No Response to get permission');
    -    }
    +    throw Error('No Response to get permission');
     }
    Suggestion importance[1-10]: 8

    __

    Why: Accessing response.status when response is null causes a runtime error; simplifying the block ensures correct error handling.

    Medium
    Handle 401 and fallback error messages

    Enhance the catch block to handle 401 responses explicitly and provide a fallback
    error message when no errorMessage is present. This prevents throwing
    Error(undefined) and ensures proper access-denied messaging.

    packages/client/src/stores/monolith/monolith.store.ts [1894-1896]

     }).catch((error) => {
    -        throw Error(error.response?.data?.errorMessage);
    +    if (error.response?.status === 401) {
    +        throw Error('User does not have access to this project');
    +    }
    +    throw Error(error.response?.data?.errorMessage ?? 'Failed to get permission');
     });
    Suggestion importance[1-10]: 7

    __

    Why: The enhanced catch block explicitly checks for 401 errors and provides a fallback message, preventing a potential Error(undefined) scenario.

    Medium

    @anurag91jain anurag91jain requested a review from a team June 5, 2025 19:58
    @anurag91jain anurag91jain merged commit 66e0913 into dev Jun 10, 2025
    3 checks passed
    @anurag91jain anurag91jain deleted the NoAccess_App_msg branch June 10, 2025 14:03
    @github-actions
    Copy link
    Copy Markdown

    @CodiumAI-Agent /update_changelog

    @QodoAI-Agent
    Copy link
    Copy Markdown

    Changelog updates: 🔄

    2025-06-10 *

    Added

    • Show error message when users attempt to access a page without sufficient permissions

    to commit the new content to the CHANGELOG.md file, please type:
    '/update_changelog --pr_update_changelog.push_changelog_changes=true'

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    4 participants