撰寫可採取行動的錯誤訊息
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本頁說明如何編寫實用的錯誤訊息,引導使用者修正問題,順利完成目標。
使用者與 Google Chat 應用程式互動時,如果遇到無法採取行動的錯誤訊息,可能會感到沮喪。舉例來說,錯誤訊息 An error occurred
並不實用,因為該訊息並未說明發生錯誤的原因、使用者如何修正問題,或如何尋求協助。本頁面說明如何建構錯誤訊息,讓使用者能從中獲益,並提供可採取行動和無法採取行動的範例。
錯誤訊息結構
提供可行建議的錯誤訊息結構如下:
- 發生錯誤。說明對話應用程式無法完成要求的原因,有助於使用者解決問題。說明發生錯誤的原因,有助於建立信任感。
- 使用者如何朝目標邁進。光是說明問題所在還不夠,告訴使用者如何解決錯誤並完成目標。
- 如何取得協助。如果使用者仍無法解決問題,請告知如何取得進一步協助。這可以是
/help
指令,也可以是 Chat 應用程式的文件連結。
在這個例子中,使用者輸入的日期格式不符合 Chat 應用程式的預期。他們寫的是
November 19, 2021
,但 Chat 應用程式預期的是
2021-11-19
。
以下是 Chat 應用程式回覆的錯誤訊息,分為可採取行動和無法採取行動兩種版本:
可採取行動的錯誤
使用者要求 Chat 應用程式與其他人安排會議。Chat 應用程式會回覆實用且可採取行動的錯誤訊息:
I don't recognize the date format you entered. Write dates as `yyyy-mm-dd`; for example, `2000-01-31`. For help, type `/help`.
這則錯誤訊息可採取行動的原因如下:
- 說明發生什麼問題。Chat 應用程式無法辨識日期格式。
- 說明如何修正錯誤,告知使用者預期的日期格式,並提供範例日期,協助使用者瞭解該如何輸入。
- 透過
/help
斜線指令提供更多協助。如果使用者仍無法解決問題,他們也知道如何取得更多資訊。
無法採取行動的錯誤
使用者要求 Chat 應用程式與其他人安排會議。Chat 應用程式會回覆無用且無法採取行動的錯誤訊息:
Enter the correct date format.
由於下列原因,這則錯誤訊息無法採取任何行動:
- 但不會說明是否已排定會議。使用者可能不願重新安排會議,或以為會議已排定。
- 未告知使用者如何設定日期格式。請勿假設使用者知道如何格式化日期,而是說明系統預期日期格式為
yyyy-mm-dd
。
- 無法提供更多協助。如果使用者遇到困難,不知道該如何繼續,可能會停止傳送訊息給 Chat 應用程式。
立即試用
現在您已瞭解如何編寫可採取行動的錯誤訊息,請在下列情境中找出可採取行動的錯誤訊息:
使用者傳送含有關鍵字 schedule
的訊息給 Chat 應用程式時,該應用程式會建立日曆活動。如要建立日曆活動,Chat 應用程式必須先驗證使用者身分。如果使用者尚未通過驗證,Chat 應用程式會傳回錯誤訊息。
哪些錯誤訊息提供可行建議?
你必須先輸入 /signin
登入,我才能安排會議。如要瞭解詳情,請輸入 /help
。
這則錯誤訊息可採取行動,因為內容如下:
- 你遇到了什麼問題?Chat 應用程式需要驗證。
- 如何繼續。輸入
/signin
進行驗證。
- 如何取得協助。如果使用者想瞭解更多資訊,可以輸入
/help
。
您必須通過驗證。
這則錯誤訊息並未說明如何驗證,因此無法採取行動。
登入。
這則錯誤訊息無法提供任何協助,因為訊息中未說明如何登入,且含糊不清地暗示使用者已登出,容易造成混淆。
無法排定會議時間。
這則錯誤訊息無法提供任何協助,因為訊息中並未說明無法安排會議的原因,或使用者該如何繼續操作。未提供說明。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[[["\u003cp\u003eGoogle Chat app error messages should be actionable, guiding users on how to resolve issues and proceed.\u003c/p\u003e\n"],["\u003cp\u003eActionable error messages clearly explain the problem, provide steps for fixing it, and offer additional help resources.\u003c/p\u003e\n"],["\u003cp\u003eInactionable error messages are vague, lack guidance, and can lead to user frustration and abandonment.\u003c/p\u003e\n"],["\u003cp\u003eUse the actionable error message structure: state the problem, guide the user on fixing it, and offer further help (e.g., \u003ccode\u003e/help\u003c/code\u003e command).\u003c/p\u003e\n"],["\u003cp\u003eWhen writing error messages, assume users need clear instructions and avoid ambiguity.\u003c/p\u003e\n"]]],["Actionable error messages in Google Chat apps should specify what went wrong, how to fix it, and how to get further assistance. For example, an actionable message for an incorrect date format would state that the format is unrecognized, specify the required format (yyyy-mm-dd), and provide a /help command. In contrast, inactionable errors are vague, omit how to correct the issue, and offer no additional support. A sign-in error should also include clear instructions, and help commands.\n"],null,["# Write actionable error messages\n\nThis page describes best practices to write actionable error messages that tell\nthe user how to fix the issue so that they can complete their goal.\n\nWhen a user is interacting with a Google Chat app, encountering\nerror messages can be a frustrating experience when the error isn't actionable.\nFor example, the error message, `An error occurred`, isn't useful because the\nmessage doesn't explain what went wrong, how the user can fix the issue, or how\nthe user can get help. This page describes how to structure error messages so\nthat they're useful to users by showing actionable and inactionable examples.\n\nError message structure\n-----------------------\n\nAn actionable error message has the following structure:\n\n- **What went wrong.** Saying why the Chat app can't complete a request helps the user resolve the issue. Explaining why an error occurred builds trust.\n- **How the user can proceed toward their goal.** It's never enough to just say what went wrong. Tell users how they can move past the error and complete their goal.\n- **How to get help.** If the user is still stuck, tell them how they can get more help. This could be a `/help` command or a link to documentation for your Chat app.\n\nExample error message: incorrect date format\n--------------------------------------------\n\nIn this example, the user entered a date in a format that\nthe Chat app didn't expect. They wrote\n`November 19, 2021`, but the Chat app expects\n`2021-11-19`.\n\nHere's an actionable and an inactionable version of the error message that the\nChat app responds with:\n\n#### Actionable error\n\nA user asks the Chat app to schedule a meeting with\nanother person. The Chat app responds with a good,\nactionable error message:\n\n``I don't recognize the date format you entered. Write dates as `yyyy-mm-dd`; for example, `2000-01-31`. For help, type `/help`.``\n\nThis error message is actionable for the following reasons:\n\n- Says what went wrong. The Chat app doesn't recognize the date format.\n- Explains how to fix the error by telling the user the expected date format and gives an example date that helps people understand what to write.\n- Offers more help with a `/help` slash command. If users are still stuck, they know how to learn more.\n\n#### Inactionable error\n\nA user asks the Chat app to schedule a meeting with\nanother person. The Chat app responds with an\nunhelpful, inactionable error message:\n\n`Enter the correct date format.`\n\nThis error message is inactionable for the following reasons:\n\n- Doesn't say whether it scheduled the meeting. The user might be hesitant to reschedule the meeting, or they might assume that the meeting was scheduled.\n- Doesn't tell the user how to format the date. Instead of assuming that users know how to format the date, it should say that it's expecting the date format `yyyy-mm-dd`.\n- Doesn't offer more help. When users are stuck and don't know how to proceed, they might stop messaging the Chat app.\n\nTry it out\n----------\n\nNow that you know how to write actionable errors, can you identify in the\nfollowing scenario which of these errors is actionable:\n\nA Chat app creates calendar events when users message\nthe Chat app with the keyword `schedule`. To\ncreate a calendar event, the Chat app requires user\nauthentication. If a user hasn't been authenticated, then the\nChat app responds with an error message. \nWhich error message is actionable? \nBefore I can schedule the meeting, you must sign in by typing `/signin`. To learn more, type `/help`. \nThis error message is actionable because it says the following:\n\n- What went wrong. The Chat app requires authentication.\n- How to proceed. Type `/signin` to authenticate.\n- How to get help. If the user wants more information, they can type `/help`. \nYou must authenticate. \nThis error message is inactionable because it doesn't say how to authenticate. \nSign in. \nThis error message is inactionable because it doesn't say how to sign in, and it implies that the user is signed out instead of clearly saying so, which is confusing. \nCan't schedule meeting. \nThis error message is inactionable because it doesn't tell the user why the meeting can't be scheduled or how the user can proceed. No help is provided."]]