Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Web Application Good Error Message (and Bad Err...

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for moznion moznion
July 01, 2017

Web Application Good Error Message (and Bad Error Message)

A slide of YAPC::Fukuoka Hakata 2017

Avatar for moznion

moznion

July 01, 2017
Tweet

More Decks by moznion

Other Decks in Technology

Transcript

  1. - ୹ण໋ - ͦͷ৔Ͱͷରॲʹར༻ - ଈԠ - ௕ण໋ - ࠜຊతͳղܾʹར༻

    - ϝτϦΫεతʹ΋ - ͋ͱͰݕࡧͰ͖Δ Error MessageͷϥΠϑαΠΫϧ
  2. - ୹ण໋ - ͦͷ৔Ͱͷରॲʹར༻ - ଈԠ - ௕ण໋ - ࠜຊతͳղܾʹར༻

    - ϩάɾϝτϦΫεత - ͋ͱͰݕࡧͰ͖Δ Error MessageͷϥΠϑαΠΫϧ
  3. - ୹ण໋ - ͦͷ৔Ͱͷରॲʹར༻ - ଈԠ - ௕ण໋ - ࠜຊతͳղܾʹར༻

    - ϩάɾϝτϦΫεత - ͋ͱͰݕࡧͰ͖Δ Error MessageͷϥΠϑαΠΫϧ
  4. - ୹ण໋ - ͦͷ৔Ͱͷରॲʹར༻ - ଈԠ - ௕ण໋ - ࠜຊతͳղܾʹར༻

    - ϩάɾϝτϦΫεత - ͋ͱͰݕࡧͰ͖Δ Error MessageͷϥΠϑαΠΫϧ Errorͷྲྀ଎Λ ؂ࢹͯ͠alertͱ͔
  5. ରॲ͢ΔͨΊͷError Message - ͦͷ৔Ͱൃੜ͍ͯ͠Δ໰୊Λଧ౗͢Δ - e.g. ʮωοτϫʔΫྑ͍ͱ͜ΖͰࢼͯ͠ʂʯ - ղܾʹܨ͕Δ৔߹΋͋Δ -

    ར༻ऀ͕ετϨεແ͘ιϑτ΢ΣΞΛར༻͢Δ ͨΊͷखॿ͚ => Ϣʔβମݧ - ։ൃऀɾར༻ऀ૒ํ޲͚ - ୹໋ϥΠϑαΠΫϧ
  6. ѱ͍Error Messageͱ͸ - ·ͬͨ͘ঢ়گ͕Θ͔Βͳ͍ - e.g. "Something wrong!" - Ͳ͏͢Ε͹ྑ͍ͱ͍͏ͷͩ……

    - e.g. "Invalid parameter", "Query is too big" - ৘ใྔ͕ଟ͗͢Δ - ੌ·͍͡ྔͷstack trace͕ग़Δͱ͔…… - ΫϦεϚεπϦʔݱ৅
  7. HTTP Status Code - 1xx, 2xx, 3xx, 4xx, 5xx -

    ίʔυʹΑΔ1࣍ݩ৘ใ - (↑ͱ͍͏ͷ͸ਖ਼͘͠ͳ͍ɽHTTP Status Codeʹ͸ηϚϯςΟΫε͕͋Δ)
  8. - Over HTTPͳrequestͷerror response - e.g. 
 {
 "code": 1212,


    "error": "Not permitted operation"
 } API Response
  9. Exit status - `$ echo $?` - 0ͩͬͨΒ੒ޭ - ͦͷଞ͸ࣦഊ

    (ਈ࢜ڠఆ) - http://moznion.hatenadiary.com/ entry/2017/06/30/181433
  10. ୯७ͳError Log [12:29:14] DBI Exception: DBD::mysql::st execute failed: Duplicate entry

    'XXXXXXXXXXXXXX' for key 'user' [for Statement "INSERT /* ./local/lib/perl5/ Try/Tiny.pm line 77 */ INTO user (id) VALUES (?)" with ParamValues: 0="XXXXXXXXXXXXXX"] at ./lib/MyApp/Infra/ UserRepository/.pm line 123
  11. GitͷError Message $ git push origin test To github.com:moznion/sandbox.git !

    [rejected] test -> test (non-fast-forward) error: failed to push some refs to '[email protected]:moznion/ sandbox.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  12. Q?

  13. Error Message຋༁ - "SQL Error" => "500 αʔϏεʹ໰୊͕ੜ͡ ͍ͯ·͢" -

    status 5963 => "૬खͷαʔό͕Ωϟύγ ςΟΦʔόͰࢮΜͰΔʂʂ" - status code͔Βঢ়گͷจݴʹى͜͢ͳͲ ͱ͍ͬͨ࣍ݩͷΞηϯγϣϯ΋ى͖͕ͪ
  14. Q?