מפרט של TripOptionsError

סוגים לשימוש כשמדווחים על שגיאה בנסיעה. סוג השגיאה הזה נפוץ ב-GetTripOptions וב-GetBulkTripOptions.

כשמדווחת שגיאה, Google תמתין פרק זמן משתנה לפני שתשלח בקשה נוספת. ההגדרה הזו חלה גם על תגובות מוצלחות וגם על תגובות שמדווחות על שגיאות. עם זאת, אם שגיאה מסומנת כ'ניתנת לניסיון חוזר', Google תקצר משמעותית את זמן ההמתנה לפני שליחת הבקשה הבאה. כך אפשר לשחזר מהר יותר במצבים שבהם השגיאה צפויה להיות זמנית.

בקטע הבא מתוארים סוגי השגיאות שיכולים להיות מוחזרים בשדה trip_options_error:

הגדרת פרוטו

message TripOptionsError {
  // Defines the type of error that occurred.
  // A "retryable" error indicates a transient issue, and Google may re-query
  // for the trip again shortly. A "not retryable" error indicates a
  // more permanent state, and Google will not query for this trip again in the
  // near future.
  enum TripOptionsErrorType {
    // The segment corresponding to one of the provided SegmentKeys cannot be
    // found. This error is not retryable.
    SEGMENT_KEY_NOT_FOUND = 1;

    // The data for the requested trip option is not up-to-date at the partner
    // and needs to be refreshed. For partners caching responses the refresh can
    // happen live during the API call. But if partner infrastructure or high
    // latency requires an asynchronous refresh, this error code can be used to
    // prompt Google to re-query the key later. This error is retryable.
    TRIP_OPTION_CACHE_STALE = 2;

    // An unexpected error happened during retrieval of this trip, indicating a
    // bug that needs to be fixed by the partner. This error is retryable.
    INTERNAL_ERROR = 3;

    // The trip was found but the partner considers it suboptimal and
    // chooses not to sell tickets for it. This error is not retryable.
    SUBOPTIMAL_ITINERARY = 4;

    // The trip was found but the partner is not allowed to sell tickets for it
    // due to general ticketing sale restrictions. This error is not retryable.
    TICKETING_PROHIBITED = 5;

    // The partner doesn't support pricing itineraries for the requested date.
    // This error is not retryable.
    BOOKING_WINDOW_NOT_SUPPORTED = 6;
  }

  TripOptionsErrorType error_type = 1;

  // This is not user-visible and is for logging and debugging purposes only.
  string error_message = 2;
}

דוגמה לשגיאת JSON ב-TripOptionsError

{
  "error_type": "SEGMENT_KEY_NOT_FOUND",
  "error_message": "No matching segments found, no departures at 14:25"
}