Commit 3712cc3bddeec939f1a083e24bc199c9c5b35b0c
1 parent
a7744e3e
Exists in
master
and in
5 other branches
Iniciando implementação de excessões na extensão php
Showing
2 changed files
with
27 additions
and
17 deletions
Show diff stats
po/pt_BR.po
| ... | ... | @@ -5,7 +5,7 @@ msgid "" |
| 5 | 5 | msgstr "" |
| 6 | 6 | "Project-Id-Version: pw3270 5.0\n" |
| 7 | 7 | "Report-Msgid-Bugs-To: \n" |
| 8 | -"POT-Creation-Date: 2014-04-15 15:09-0300\n" | |
| 8 | +"POT-Creation-Date: 2014-04-15 15:34-0300\n" | |
| 9 | 9 | "PO-Revision-Date: 2014-02-17 08:05-0300\n" |
| 10 | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
| 11 | 11 | "Language-Team: Portugues <>\n" | ... | ... |
src/php/init.cc
| ... | ... | @@ -32,6 +32,7 @@ |
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | 34 | #include "php3270.h" |
| 35 | + #include <Zend/zend_exceptions.h> | |
| 35 | 36 | |
| 36 | 37 | /*--[ Implement ]--------------------------------------------------------------------------------------------------*/ |
| 37 | 38 | |
| ... | ... | @@ -51,25 +52,34 @@ PHP_METHOD(tn3270, __construct) |
| 51 | 52 | |
| 52 | 53 | trace("szName=%d",szName); |
| 53 | 54 | |
| 54 | - if(szName) | |
| 55 | + try | |
| 55 | 56 | { |
| 56 | - char text[szName+1]; | |
| 57 | - strncpy(text,name,szName); | |
| 58 | - text[szName] = 0; | |
| 59 | - trace("session_name=\"%s\"",text); | |
| 60 | - obj->hSession = session::start(text); | |
| 61 | - } | |
| 62 | - else | |
| 63 | - { | |
| 64 | - obj->hSession = session::start(); | |
| 65 | - } | |
| 66 | 57 | |
| 67 | - if(szURL) | |
| 58 | + if(szName) | |
| 59 | + { | |
| 60 | + char text[szName+1]; | |
| 61 | + strncpy(text,name,szName); | |
| 62 | + text[szName] = 0; | |
| 63 | + trace("session_name=\"%s\"",text); | |
| 64 | + obj->hSession = session::start(text); | |
| 65 | + } | |
| 66 | + else | |
| 67 | + { | |
| 68 | + obj->hSession = session::start(); | |
| 69 | + } | |
| 70 | + | |
| 71 | + if(szURL) | |
| 72 | + { | |
| 73 | + char text[szURL+1]; | |
| 74 | + strncpy(text,url,szURL); | |
| 75 | + text[szURL] = 0; | |
| 76 | + obj->hSession->set_url(text); | |
| 77 | + } | |
| 78 | + | |
| 79 | + } | |
| 80 | + catch(std::exception &e) | |
| 68 | 81 | { |
| 69 | - char text[szURL+1]; | |
| 70 | - strncpy(text,url,szURL); | |
| 71 | - text[szURL] = 0; | |
| 72 | - obj->hSession->set_url(text); | |
| 82 | + zend_throw_error_exception(zend_exception_get_default(), (char *) e.what(), 0, 0 TSRMLS_DC); | |
| 73 | 83 | } |
| 74 | 84 | |
| 75 | 85 | } | ... | ... |