code100x / job-board

100xdevs job board - temp domain attached ( will update soon )
https://job.vineet.tech
313 stars 448 forks source link

🐛 Bug Report: Error Handling in submitImage #505

Closed prakhyatc closed 2 weeks ago

prakhyatc commented 3 weeks ago

📜 Description

The submitImage function does not handle errors properly. If the image upload fails, it will log an error message to the console, but it will not notify the user.

👟 Reproduction steps

To trigger the bug :

  1. Fill out the form with valid data.
  2. Attempt to upload an invalid or corrupted image file (e.g., a text file renamed to .jpg).
  3. Observe the console or error logs.
  4. Verify that the image upload fails and an error message is logged to the console.
  5. Check the UI for any error notifications or messages.

👍 Expected behavior

1.The error should be caught and displayed to the user through the toast notification system or an inline error message

  1. The user should be notified that the image upload failed

👎 Actual Behavior with Screenshots

  1. The error is caught by the catch block, but only logged to the console.
  2. No user-friendly error message is displayed to the user.
  3. The form submission process may continue without notifying the user of the image upload failure

OS name

MacOS

browser name

Chrome

npm version

No response

node version

No response

📃 Provide any additional context for the Bug.

test with network errros, server-side errors, validation errors

👀 Have you spent some time to check if this bug has been raised before?

🏢 Have you read the Contributing Guidelines?

Are you willing to submit PR?

Yes I am willing to submit a PR!

devsharmagit commented 2 weeks ago

This can be fixed by adding a check before whenever the handleFileChange is triggred. I have done this locally. I can open a pull request. image