{"record":{"id":"01e25dc1ab6fe570","repo":"Semantic-Org/Semantic-UI","slug":"api-request-aborted-exit-conditions-met","errorCode":null,"errorMessage":"API Request Aborted. Exit conditions met","messagePattern":"API Request Aborted\\. Exit conditions met","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/definitions/behaviors/api.js","lineNumber":1129,"sourceCode":"  // request finished without aborting\n  onComplete  : function(response, $module) {},\n\n  // failed JSON success test\n  onFailure   : function(response, $module) {},\n\n  // server error\n  onError     : function(errorMessage, $module) {},\n\n  // request aborted\n  onAbort     : function(errorMessage, $module) {},\n\n  successTest : false,\n\n  // errors\n  error : {\n    beforeSend        : 'The before send function has aborted the request',\n    error             : 'There was an error with your request',\n    exitConditions    : 'API Request Aborted. Exit conditions met',\n    JSONParse         : 'JSON could not be parsed during error handling',\n    legacyParameters  : 'You are using legacy API success callback names',\n    method            : 'The method you called is not defined',\n    missingAction     : 'API action used but no url was defined',\n    missingSerialize  : 'jquery-serialize-object is required to add form data to an existing data object',\n    missingURL        : 'No URL specified for api event',\n    noReturnedValue   : 'The beforeSend callback must return a settings object, beforeSend ignored.',\n    noStorage         : 'Caching responses locally requires session storage',\n    parseError        : 'There was an error parsing your request',\n    requiredParameter : 'Missing a required URL parameter: ',\n    statusMessage     : 'Server gave an error: ',\n    timeout           : 'Your request timed out'\n  },\n\n  regExp  : {\n    required : /\\{\\$*[A-z0-9]+\\}/g,\n    optional : /\\{\\/\\$*[A-z0-9]+\\}/g,\n  },","sourceCodeStart":1111,"sourceCodeEnd":1147,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/api.js#L1111-L1147","documentation":"This error message is defined in the API module's settings.error dictionary for the 'exitConditions' key. It represents a request that was aborted because exit conditions were met — the module determined that the request should not proceed based on pre-flight checks. While not directly referenced by a module.error() call in the current source version, it exists as part of the error vocabulary for request cancellation scenarios.","triggerScenarios":"A request is aborted during the query phase because one or more exit conditions are met — such as the element being disabled (module.is.disabled()), a previous request still loading without interruptRequests enabled, or mock mode rejecting the response.","commonSituations":"Double-submit prevention where a second request fires while the first is pending and interruptRequests is not set. Disabled elements triggering API calls via event bindings. Mock response functions returning falsy values to simulate failures.","solutions":["Enable settings.interruptRequests: true if you want subsequent requests to supersede pending ones.","Prevent API events from firing on disabled elements by checking element state before calling query.","If using mock responses, ensure the mock responder returns a truthy value for valid responses."],"exampleFix":"// before\n$('.btn').api({\n  url: '/api/submit',\n  interruptRequests: false // second click silently fails\n});\n\n// after\n$('.btn').api({\n  url: '/api/submit',\n  interruptRequests: true,\n  throttle: 1000\n});","handlingStrategy":"validation","validationCode":"// Check exit conditions before firing the API request\nif (!$('.el').prop('disabled') && !$('.el').hasClass('loading')) {\n  $('.el').api('query');\n} else {\n  console.log('Request skipped: exit conditions met.');\n}","typeGuard":"// Check whether the element is in a state that allows API requests\nfunction canRequest($el) {\n  return !$el.prop('disabled') && !$el.hasClass('loading');\n}","tryCatchPattern":null,"preventionTips":["Set interruptRequests: true if you need the latest request to supersede pending ones.","Disable the triggering element during the request to prevent duplicate submissions.","Use throttle settings to rate-limit rapid-fire requests."],"tags":["api","abort","exit-conditions","semantic-ui"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}