parse-community / parse-community/parse-server

Add optional objectId to Parse.Error if possible

Open
#8,109 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

New Feature / Enhancement Checklist
Current Limitation

I came across an issue when using the ParseSwift framework. When using the saveAll() function, it's impossible to identify the object where the error occurred.

Feature / Enhancement Description

I would suggest to add an optional objectId to the error response coming from the server. This could then be decoded in the ParseSwift framework and can be used by developers to identify the failing object.

Example Use Case

I would change the current class Error to this:
I might need some help with implementing the constructor on the specific locations where it would be necessary.

class Error {
            static OTHER_CAUSE: ErrorCode.OTHER_CAUSE;
            static INTERNAL_SERVER_ERROR: ErrorCode.INTERNAL_SERVER_ERROR;
            static CONNECTION_FAILED: ErrorCode.CONNECTION_FAILED;
            static OBJECT_NOT_FOUND: ErrorCode.OBJECT_NOT_FOUND;
            static INVALID_QUERY: ErrorCode.INVALID_QUERY;
            static INVALID_CLASS_NAME: ErrorCode.INVALID_CLASS_NAME;
            static MISSING_OBJECT_ID: ErrorCode.MISSING_OBJECT_ID;
            static INVALID_KEY_NAME: ErrorCode.INVALID_KEY_NAME;
            static INVALID_POINTER: ErrorCode.INVALID_POINTER;
            static INVALID_JSON: ErrorCode.INVALID_JSON;
            static COMMAND_UNAVAILABLE: ErrorCode.COMMAND_UNAVAILABLE;
            static NOT_INITIALIZED: ErrorCode.NOT_INITIALIZED;
            static INCORRECT_TYPE: ErrorCode.INCORRECT_TYPE;
            static INVALID_CHANNEL_NAME: ErrorCode.INVALID_CHANNEL_NAME;
            static PUSH_MISCONFIGURED: ErrorCode.PUSH_MISCONFIGURED;
            static OBJECT_TOO_LARGE: ErrorCode.OBJECT_TOO_LARGE;
            static OPERATION_FORBIDDEN: ErrorCode.OPERATION_FORBIDDEN;
            static CACHE_MISS: ErrorCode.CACHE_MISS;
            static INVALID_NESTED_KEY: ErrorCode.INVALID_NESTED_KEY;
            static INVALID_FILE_NAME: ErrorCode.INVALID_FILE_NAME;
            static INVALID_ACL: ErrorCode.INVALID_ACL;
            static TIMEOUT: ErrorCode.TIMEOUT;
            static INVALID_EMAIL_ADDRESS: ErrorCode.INVALID_EMAIL_ADDRESS;
            static MISSING_CONTENT_TYPE: ErrorCode.MISSING_CONTENT_TYPE;
            static MISSING_CONTENT_LENGTH: ErrorCode.MISSING_CONTENT_LENGTH;
            static INVALID_CONTENT_LENGTH: ErrorCode.INVALID_CONTENT_LENGTH;
            static FILE_TOO_LARGE: ErrorCode.FILE_TOO_LARGE;
            static FILE_SAVE_ERROR: ErrorCode.FILE_SAVE_ERROR;
            static DUPLICATE_VALUE: ErrorCode.DUPLICATE_VALUE;
            static INVALID_ROLE_NAME: ErrorCode.INVALID_ROLE_NAME;
            static EXCEEDED_QUOTA: ErrorCode.EXCEEDED_QUOTA;
            static SCRIPT_FAILED: ErrorCode.SCRIPT_FAILED;
            static VALIDATION_ERROR: ErrorCode.VALIDATION_ERROR;
            static INVALID_IMAGE_DATA: ErrorCode.INVALID_IMAGE_DATA;
            static UNSAVED_FILE_ERROR: ErrorCode.UNSAVED_FILE_ERROR;
            static INVALID_PUSH_TIME_ERROR: ErrorCode.INVALID_PUSH_TIME_ERROR;
            static FILE_DELETE_ERROR: ErrorCode.FILE_DELETE_ERROR;
            static REQUEST_LIMIT_EXCEEDED: ErrorCode.REQUEST_LIMIT_EXCEEDED;
            static INVALID_EVENT_NAME: ErrorCode.INVALID_EVENT_NAME;
            static USERNAME_MISSING: ErrorCode.USERNAME_MISSING;
            static PASSWORD_MISSING: ErrorCode.PASSWORD_MISSING;
            static USERNAME_TAKEN: ErrorCode.USERNAME_TAKEN;
            static EMAIL_TAKEN: ErrorCode.EMAIL_TAKEN;
            static EMAIL_MISSING: ErrorCode.EMAIL_MISSING;
            static EMAIL_NOT_FOUND: ErrorCode.EMAIL_NOT_FOUND;
            static SESSION_MISSING: ErrorCode.SESSION_MISSING;
            static MUST_CREATE_USER_THROUGH_SIGNUP: ErrorCode.MUST_CREATE_USER_THROUGH_SIGNUP;
            static ACCOUNT_ALREADY_LINKED: ErrorCode.ACCOUNT_ALREADY_LINKED;
            static INVALID_SESSION_TOKEN: ErrorCode.INVALID_SESSION_TOKEN;
            static LINKED_ID_MISSING: ErrorCode.LINKED_ID_MISSING;
            static INVALID_LINKED_SESSION: ErrorCode.INVALID_LINKED_SESSION;
            static UNSUPPORTED_SERVICE: ErrorCode.UNSUPPORTED_SERVICE;
            static AGGREGATE_ERROR: ErrorCode.AGGREGATE_ERROR;
            static FILE_READ_ERROR: ErrorCode.FILE_READ_ERROR;
            static X_DOMAIN_REQUEST: ErrorCode.X_DOMAIN_REQUEST;

            code: ErrorCode;
            message: string;
            objectId: string;

            constructor(code: ErrorCode, message: string, objectId: string = null);
        }
Alternatives / Workarounds

There are none

3rd Party References

n/a

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how Parse.Error instances are constructed and how saveAll() errors are assembled into server responses. Determine where an optional objectId can be propagated without changing errors that lack an object, then verify that failing objects can be identified by the resulting response and that existing error behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.