Gulp-bower throws error 'calling transform done when ws.length != 0' - gulp

During Gulp build I sometimes get the error 'calling transform done when ws.length != 0' and the stack traces gives path node_modules\gulp-bower\node_modules\readable-stream\lib_stream_transform.js:204
I am not able to track the source of the error in build.js. How to find the code from where it is called upon?

Related

Q.nfcall: TypeCast fails on an unspecified error

I'm learning node, and I'm having a hard time writing the back-end code for my database interactions. A promise based implementation looked a lot cleaner than doing it all using callbacks, so I did some digging and found Q.
I'm having trouble understanding what I'm doing wrong here, or even where. The error function inside .then seems to be catching the TypeCast error, but I don't know what I'd be doing that would be causing that error?
Running the following script
mysql = require('mysql');
var q = require('q')
var dbx = mysql.createConnection({
//this is verified correct...
});
function getuser3(UserDisplayName) {
return q.nfcall(dbx.query, "SELECT * FROM Users WHERE Name = ? ", [UserDisplayName])
// This should wrap the query function with a promise, apply the arguments "SELECT..." ,
// [UserDisplayName], and set up the last-argument-node-style callback so it fulfills the promise
// with either a value or an error. If I understand correctly.
}
val = getuser3("Player2")
.then(
function (value) {
console.log(value)
return value //this should be sent to val in the outside scope, right?
},
function (error) {
console.log(error)
}
)
.done()
console.log(val)
Returns the following error:
c:\Users\cb\Documents\guts\learning node\backend\node_modules\q\q.js:155
throw e;
^
TypeError: Cannot read property 'typeCast' of undefined
at query (c:\Users\cb\Documents\guts\learning node\backend\node_modules\mysql\lib\Connection.js:185:34)
at Promise.apply (c:\Users\cb\Documents\guts\learning node\backend\node_modules\q\q.js:1185:26)
at Promise.promise.promiseDispatch (c:\Users\cb\Documents\guts\learning node\backend\node_modules\q\q.js:808:41)
at c:\Users\cb\Documents\guts\learning node\backend\node_modules\q\q.js:1411:14
at runSingle (c:\Users\cb\Documents\guts\learning node\backend\node_modules\q\q.js:137:13)
at flush (c:\Users\cb\Documents\guts\learning node\backend\node_modules\q\q.js:125:13)
at processTicksAndRejections (internal/process/task_queues.js:79:11)
Process exited with code 1
I've tried several variations of the syntax, reading the docs as best I could, but I really don't know where to go next.

How to catch parse errors in Lucerne (common lisp)

I'm trying to build a simple rest api in Lucerne, but the clack:call method fails if the json is malformed. So, I extended the bass-app class and added an around method:
(defclass tracker-app (base-app) ()
(:documentation "An extension of lucerne's base app to control behavior"))
(defmethod clack:call :around ((app tracker-app) env)
(handler-case (call-next-method)
(fast-http:cb-message-complete (e)
(vom:error "could not build message body: ~a" e)
(respond nil :status 400))
(:no-error (res) res)))
(defapp server :class 'tracker-app)
(start server :server woo)
But the parse error continues to crash the server.
I don't know much about clos, so I'm worried I've misunderstood how to catch errors in this context.
Edit: Added start information
Edit: Added stack trace
Assuming *features* does not contain :catch-any-error, here is a complete test case:
(ql:quickload :lucerne)
(defpackage :so.lucerne (:use :cl :lucerne))
(in-package :so.lucerne)
(defclass tracker-app (base-app) ()
(:documentation "An extension of lucerne's base app to control behavior"))
(defmethod clack:call :around ((app tracker-app) env)
(handler-case (call-next-method)
(fast-http:cb-message-complete (e)
(warn "could not build message body: ~a" e)
(respond nil :status 400))
#+catch-any-error
(error (e) (break "BREAK with ~a" e))
(:no-error (res) res)))
(defmethod clack:call ((app tracker-app) env)
(error "Oh No"))
(defapp server :class 'tracker-app)
(start server :server :woo)
When I try to load localhost:8000, the following error is shown:
Callback Error: the message-complete callback failed
Oh No
[Condition of type FAST-HTTP.ERROR:CB-MESSAGE-COMPLETE]
Pressing Enter on [Condition of type FAST-HTTP.ERROR:CB-MESSAGE-COMPLETE] gives:
#<FAST-HTTP.ERROR:CB-MESSAGE-COMPLETE {10048315C3}>
--------------------
The object is a CONDITION of type FAST-HTTP.ERROR:CB-MESSAGE-COMPLETE.
FORMAT-CONTROL: NIL
FORMAT-ARGUMENTS: NIL
DESCRIPTION: "the message-complete callback failed"
ERROR: #<SIMPLE-ERROR "Oh No" {1004831583}>
The error wraps another error.
Now if I (push :catch-any-error *features*) and recompile the above method, the same test makes the code reach the (break ...) statement, which is shown as BREAK with Oh No.
Explanation
No fast-http:cb-message-complete is caught, and in fact no such condition is signaled at this point; instead at this location we only can catch the specific error that was signaled. It is only higher up in the call stack that errors are wrapped inside fast-http:cb-message-complete errors.
Solution
In your case you can directly catch jonathan.error:<jonathan-error> (unusual naming convention, but ok), the base class of all errors in the jonathan library (you could catch the specific error type, but then you risk missing some other cases).
[This answer is wrong: fast-http.error:cb-message-complete & fast-http:cb-message-complete seem to be the same symbol. I am leaving it here for posterity.]
You are not handling the right condition (and in fact I'm not sure you're handling a condition which exists at all, which I'd expect the system to have warned about perhaps, although perhaps it can't).
You need to handle fast-http.error:cb-message-complete, but your handler specifies fast-http:cb-message-complete. The first of these is a condition (defined here, while the second is I think implicitly define here and is not a condition but the name of a function I think.
A more general trick is to try to handle some much-too-general error: you will probably end up handling things you don't know how to handle, but if your handler gets invoked you know that the call stack looks like you think it does when the error is signalled. Then you can start handling the errors you actually care about. In this case that probably means fast-http.error:callback-error I think.

Convert CSV to ARFF using IKVM and WEKA

CSVLoader loader = new CSVLoader();
loader.setSource(new File("));
Instances data = loader.getDataSet();
When i run above code in java , it's working fine.
But when i do the same thing in c# using the following code, it throws exception in line
weka.core.Instances instsOrg = csvLoader.getDataSet();
The exception message is" The type initializer for 'weka.core.converters.ConverterUtils' threw an exception"
string filename = "myCSVfile.csv"";
weka.core.converters.CSVLoader csvLoader = new weka.core.converters.CSVLoader();
csvLoader.setSource(new java.io.File(filename));
weka.core.Instances instsOrg = csvLoader.getDataSet();
weka.core.converters.ArffSaver saver = new weka.core.converters.ArffSaver();
saver.setInstances(data);
saver.setFile(new File("myCSVfile.arff"));
saver.writeBatch();
I have added weka.dll , IKVM.OpenJDK.Core.dll and IKVM.Runtime as references files.
Can anyone help me to get rid of this exception please???
Please reply as soon as possible :(

Drupal 7 Solr Indexing Error showing "EntityMalformedException: Missing bundle property on entity of type taxonomy_term"

In Drupal 7.14, when i Index my Whole Site, Solr is showing following error:
AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows.
Path: /batch?id=1938&op=do StatusText: Service unavailable (with message)
ResponseText: EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7539 of /project/path/includes/common.inc).
So when i look into the lines in /includes/common.inc (around lines: 7537):
// Explicitly fail for malformed entities missing the bundle property.
if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
throw new EntityMalformedException(t('Missing bundle property on entity of type #entity_type.', array('#entity_type' => $entity_type)));
}
What is that chunk of code (in common.inc) is doing actually please?
How can i overcome that error?
Please, try this module https://drupal.org/project/taxonomy_orphanage it will delete all empty bundles.

Alfresco exception message format

I want to show only my message for alfresco workflow exception. But in alfresco exception message format is that
1. exception.class.name
2. ErrorLogNumber
3. Message
For example,
org.alfresco.service.cmr.workflow.WorkflowException: 05130007 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I only want to show 3.Message not 1.exception.class.name and 2.ErrorLogNumber. I can remove ErrorLogNumber from message by adding a custom exception class. But I can't remove 1.exception.class.name from error message.
Let me know how to implement that.
The solution is quite simple. Just throw AlfrescoRuntimeException with your message.
throw new AlfrescoRuntimeException("your.message");
In that case you get a message, but loose exception subtyping.
It is really hard to explain in words how I was suprised when saw exception handling in alfresco javaScript code:
onFormSubmitFailure: function FormManager_onFormSubmitFailure(response)
{
var failureMsg = null;
if (response.json && response.json.message && response.json.message.indexOf("Failed to persist field 'prop_cm_name'") !== -1)
{
failureMsg = this.msg("message.details.failure.name");
}
else if (response.json && response.json.message && response.json.message.indexOf("PropertyValueSizeIsMoreMaxLengthException") !== -1)
{
failureMsg = this.msg("message.details.failure.more.max.length");
}
else if (response.json && response.json.message && response.json.message.indexOf("org.alfresco.error.AlfrescoRuntimeException") == 0)
{
var split = response.json.message.split(/(?:org.alfresco.error.AlfrescoRuntimeException:\s*\d*\s*)/ig);
if (split && split[1])
{
failureMsg = split[1];
}
}
Alfresco.util.PopupManager.displayPrompt(
{
title: this.msg(this.options.failureMessageKey),
text: failureMsg ? failureMsg : (response.json && response.json.message ? response.json.message : this.msg("message.details.failure"))
});
},
As you can see they "catch" class name from java and replace it with message. I hope they provide more extensible way to handle custome exceptions.
P.S. Of course another way is to extend alfresco.js file and add one more if else condition for you exception.
Have you tried to override toString in your exception class? Or maybe to change logger implementation, if output is printed this way.
I had similar problem as you and failed to trace where this message is created even using debugger, quite tricky. Also anyone on Alfresco forums couldn't help me.
I developed a workaround instead of throwing an exception directly in java workflow task, I used a JS validation in form (the way I told you in another post), there I called a java webscript using ajax, which in case of error displayed JS alert box.