Follow-up use errors instead of errorMessage for Subscriptions::Security::PolicyProjectCreated
The following discussion from !158028 (merged) should be addressed:
-
@aturinske started a discussion: (+3 comments) @Andyschoenen why did you create the
errorMessagefield instead of usingerrors?errorMessagedoesn't seem to trigger the error on the frontend?apollo: { $subscribe: { // eslint-disable-next-line @gitlab/vue-no-undef-apollo-properties newlyCreatedPolicyProject: { query() { return getSecurityPolicyProjectSub; }, variables() { return { fullPath: this.namespacePath }; }, result({ data: { securityPolicyProjectCreated } }) { if (!securityPolicyProjectCreated) return; const { errorMessage, project } = securityPolicyProjectCreated; console.log('securityPolicyProjectCreated', securityPolicyProjectCreated); if (errorMessage) { throw new Error(errorMessage); } if (project) { this.currentAssignedPolicyProject = { ...project, branch: project?.branch?.rootRef, }; } }, error(e) { console.log(e); this.setError(e); this.setLoadingFlag(false); }, skip() { return !this.glFeatures.securityPoliciesProjectBackgroundWorker; }, }, }, },
Implementation plan
- Add
errorsto thesecurityPolicyProjectCreatedsubscription. - Mark
errorMessageas deprecated. - Update frontend to use
errorsinstead oferrorMessage. - Remove
errorMessage.