[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/webpaste 30e78d6 164/298: Refactored the error callbacks
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/webpaste 30e78d6 164/298: Refactored the error callbacks |
Date: |
Thu, 9 Dec 2021 19:00:06 -0500 (EST) |
branch: elpa/webpaste
commit 30e78d6fe1a94bed3cbf7786f674c2e18d33b366
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>
Refactored the error callbacks
---
tests/test-webpaste-provider-creation.el | 12 ++++++------
webpaste.el | 16 ++++++++--------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/tests/test-webpaste-provider-creation.el
b/tests/test-webpaste-provider-creation.el
index 02836fa..a7f5c3f 100644
--- a/tests/test-webpaste-provider-creation.el
+++ b/tests/test-webpaste-provider-creation.el
@@ -19,9 +19,9 @@
:success-lambda (lambda () (cl-function
(lambda (&key data &allow-other-keys)
(setq used-lambda "success"))))
- :error-lambda (cl-function
- (lambda (&key error-thrown &allow-other-keys)
- (setq used-lambda "error")))))
+ :error-lambda (lambda (&rest rest) (cl-function
+ (lambda (&key error-thrown
&allow-other-keys)
+ (setq used-lambda "error"))))))
(setq working-provider
(webpaste-provider
@@ -31,9 +31,9 @@
:success-lambda (lambda () (cl-function
(lambda (&key data &allow-other-keys)
(setq used-lambda "success"))))
- :error-lambda (cl-function
- (lambda (&key error-thrown &allow-other-keys)
- (setq used-lambda "error"))))))
+ :error-lambda (lambda (&rest rest) (cl-function
+ (lambda (&key error-thrown
&allow-other-keys)
+ (setq used-lambda "error")))))))
(it
diff --git a/webpaste.el b/webpaste.el
index 96730e5..ab0baae 100644
--- a/webpaste.el
+++ b/webpaste.el
@@ -100,17 +100,17 @@ precalculated, and also available both for pre and post
request access.")
;;; Predefined error lambda for providers
-(defvar webpaste/providers-error-lambda
+(cl-defun webpaste/providers-error-lambda (&key text)
+ "Predefined error callback for providers that always does failover."
(cl-function (lambda (&key error-thrown &allow-other-keys)
(message "Got error: %S" error-thrown)
- (webpaste-paste-text text)))
- "Predefined error callback for providers that always does failover.")
+ (webpaste-paste-text text))))
-(defvar webpaste/providers-error-lambda-no-failover
+(cl-defun webpaste/providers-error-lambda-no-failover (&key text)
+ "Predefined error callback for providers that shouldn't do failover."
(cl-function (lambda (&key error-thrown &allow-other-keys)
- (message "Got error: %S" error-thrown)))
- "Predefined error callback for providers that shouldn't do failover.")
+ (message "Got error: %S" error-thrown))))
;;; Predefined success lambdas for providers
@@ -183,7 +183,7 @@ precalculated, and also available both for pre and post
request access.")
(parser 'buffer-string)
(lang-overrides '())
(lang-uri-separator nil)
- (error-lambda
webpaste/providers-error-lambda)
+ (error-lambda
'webpaste/providers-error-lambda)
(post-field-lambda
webpaste/providers-default-post-field-lambda)
(sync nil))
"Function to create the lambda function for a provider.
@@ -266,7 +266,7 @@ Optional params:
:parser parser
:success (funcall success-lambda)
:sync sync
- :error error-lambda))))
+ :error (funcall error-lambda :text text)))))
- [nongnu] elpa/webpaste 5e963e8 275/298: Fix bug in webpaste-paste-buffer-or-region when you don't have a region, (continued)
- [nongnu] elpa/webpaste 5e963e8 275/298: Fix bug in webpaste-paste-buffer-or-region when you don't have a region, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 9662b1c 280/298: Bump version number and copyright year, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 3c9d2e8 284/298: Merge branch 'github-actions', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 4ec1645 297/298: Readme: Update branch name, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 92a5867 088/298: Spaces, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste ca539eb 101/298: Rename and update tests for provider priority, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste ee5b4ed 141/298: Move function declaration of the get-lang-alist-with-overrides function up, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 0df8ea0 144/298: Hide some options from customize, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 7bd2cec 148/298: Added support to open created pastes in browser, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste d37a904 160/298: Fix POST bug for several providers, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 30e78d6 164/298: Refactored the error callbacks,
ELPA Syncer <=
- [nongnu] elpa/webpaste d27e571 182/298: Added integration tests for paste.pound-python.org, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 76d4ddb 162/298: Update test to test the right function, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 4937b30 177/298: Change integration test to contain a link to webpaste in the pasted message, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 6b0043b 181/298: Added integration tests for dpaste.de, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 505ffb3 189/298: Switched all webpaste/whatever to webpaste-watever to comply with elisp guidelines, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 0546284 176/298: Added types to some defcustom missing it, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 321e6a4 191/298: Added more details for contributing, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 26b4d21 192/298: Added test of appending mode name to post data, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 8d5e884 200/298: Added skeleton of documentation for creation of custom providers., ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 655a364 205/298: Remove local variables since it became easier to get the providers, ELPA Syncer, 2021/12/09