Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try catch... #36

Closed
sapkal-manish opened this issue Jun 1, 2012 · 8 comments
Closed

try catch... #36

sapkal-manish opened this issue Jun 1, 2012 · 8 comments

Comments

@sapkal-manish
Copy link

in my store procedure in ms sql 2008, i am using try...catch... finally block.
but it gives me error.
eg.

ALTER PROCEDURE [dbo].[usp_UserFriends](@mode VARCHAR%2850%29='',
.... Some Parameter%28s%29)
AS
BEGIN
SET NOCOUNT ON

--BEGIN TRY
--  BEGIN TRANSACTION 

        DECLARE @SQL VARCHAR(8000) = ''

    IF @Mode='Insert'   
    BEGIN
                       -- My code goes here....
            END

--  IF @@TRANCOUNT > 0
--      COMMIT TRANSACTION 
--END TRY
--BEGIN CATCH
--  IF @@TRANCOUNT > 0
--      ROLLBACK TRANSACTION 

--  DECLARE @ErrorMessage NVARCHAR(4000) = 'usp_UserProfileMst Error : ' + ERROR_MESSAGE();
--  RAISERROR (@ErrorMessage, 16, 1);
--END CATCH

SET NOCOUNT OFF

END

here i am comment out my try...catch block..
if i have to made any correction, please suggest me.

thank you very much

@pekim
Copy link
Collaborator

pekim commented Jun 4, 2012

What error do you get Manish?

Does the error occur only when the catch block is executed, or does it occur regardless of whether the catch block is executed?

@sapkal-manish
Copy link
Author

it occur regardless of catch block is executed.

i just un comment try...catch block from store procedure, and it give me error...

@pekim
Copy link
Collaborator

pekim commented Jul 20, 2012

What error do you get? Is it from the server, from tedious, or Javascript error?
What version of tedious are you using?

If the error is something like Unsupported ENVCHANGE type ... then can you try with the latest from master please?

@sapkal-manish
Copy link
Author

iisnode encountered an error when processing the request.

HTTP status: 500
HTTP reason: Internal Server Error

You are receiving this HTTP 200 response because

E:...\node_modules\tedious\lib\token\token-stream-parser.js:103
throw error;

Error: Unsupported ENVCHANGE type 8 BEGIN_TXN at offset 3
at Object.227 (E:...\node_modules\tedious\lib\token\env-change-token-parser.js:67:15)
at Parser.nextToken (E:...\node_modules\tedious\lib\token\token-stream-parser.js:81:34)
at Parser.addBuffer (E:...\node_modules\tedious\lib\token\token-stream-parser.js:65:17)
at Connection.sendPacketToTokenStreamParser (E:...\node_modules\tedious\lib\connection.js:439:35)
at Connection.<anonymous> (E:...\node_modules\tedious\lib\connection.js:146:23)
at Connection.dispatchEvent (E:...\node_modules\tedious\lib\connection.js:375:59)
at MessageIO.<anonymous> (E:...\node_modules\tedious\lib\connection.js:329:20)
at MessageIO.emit (events.js:67:17)
at MessageIO.<anonymous> (E:...\node_modules\tedious\lib\message-io.js:47:12)
at Socket.<anonymous> (E:...\node_modules\tedious\lib\message-io.js:3:59)

@sapkal-manish
Copy link
Author

i have got 'Unsupported ENVCHANGE type' error as you mentioned. but i can't understand your given solution.
please explain me what you want to say... (If the error is something like Unsupported ENVCHANGE type ... then can you try with the latest from master please?)

@pekim
Copy link
Collaborator

pekim commented Jul 21, 2012

Support for transactions has been added, which includes recognition of the ENVCHANGE tokens that relate to transactions. It is in the master branch, but has not been published to npm yet.

You can clone the repo, and use npm link (or however you prefer to use a local copy of a project).

Or you can wait a few days (maybe a week), and I'll publish a new version of tedious to npm. Sorry it's taken so long to get transaction support out there.

@sapkal-manish
Copy link
Author

thank you very much sir... i am waiting for 1 more week ...

@pekim
Copy link
Collaborator

pekim commented Jul 21, 2012

I've just published v0.0.7, which has support for transactions.

@pekim pekim closed this as completed Jul 21, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants