I'm getting this compiling error but am not quite sure how to fix it -
1073: Syntax error: expecting a catch or a finally clause.
function __setProp___id98__Dage_APOP_Content_0()
{
if (__setPropDict[__id98_] == undefined || !(int(__setPropDict[__id98_]) >= 1 && int(__setPropDict[__id98_]) <= 5))
{
__setPropDict[__id98_] = currentFrame;
try
{
__id98_["componentInspectorSetting"] = true;
}
catch (e:Error)
{
try
{
}
__id98_["componentInspectorSetting"] = false;
}
catch (e:Error)
{
}
}
return;
} // end
Your catch block has been misplaced. This code is also very redundant, possibly generated from a decompiler?
function __setProp___id98__Dage_APOP_Content_0() {
if (__setPropDict[__id98_] == undefined|| !(int(__setPropDict[__id98_]) >= 1 && int(__setPropDict[__id98_]) <= 5)) {
__setPropDict[__id98_] = currentFrame;
try {
__id98_["componentInspectorSetting"] = true;
} catch (e:Error) {
try {
__id98_["componentInspectorSetting"] = false;
} catch(e:Error) {}
}
}
}
Related
I have this code in my controller:
...
if (Model::validateMultiple($ttepk)) {
$transaction = \Yii::$app->db->beginTransaction();
try {
foreach ($ttepk as $ttep) {
$ttep->save(false);
if (!$ttep->assignPs()) {
throw new UserException('assignPs failed');
}
}
$transaction->commit();
return $this->redirect(['index']);
} catch (Exception $ex) {
$transaction->rollBack();
throw $ex;
}
}
...
in model:
...
public function assignPs() {
foreach (...) {
$ttepetk[...] = new Ttepet;
$ttepetk[...]->ttepId = $this->id;
... // set other attributes
}
}
if (Model::validateMultiple($ttepetk)) {
foreach ($ttepetk as $ttepet) {
$ttepet->save(false);
}
return true;
} else {
return false;
}
}
...
Everything is working fine (no inserts are happening if any of the models fail validation), except that I would like to see the exact error, exactly by which Ttep (each Ttep is a model) and by which Ttepet (Ttep:Ttepet = 1:N) has the error happened, and what was that. Now I see the Exeption page only, and I don't know how to make the errors visible. Please point me to the right direction. Thanks!
You could iterate on each single model validating one by one and getting the errors when occurs ...
if (Model::validateMultiple($ttepetk)) {
foreach ($ttepetk as $ttepet) {
$ttepet->save(false);
}
return true;
} else {
foreach($ttepetk as $model){
if ($model->validate()) {
// all inputs are valid
} else {
// validation failed: $errors is an array containing error messages
$errors = $model->errors;
}
}
return $errors;
}
you can get the errors this way
$myErrorResult = $ttep->assignPs();
if (!$myErrorResult) {
......
We need to print Arabic text using Bluetooth Printer in windows phone 8 silver light app. Printing is working fine for English When we are trying to print Arabic text it is not printing as expected? Sample code is given Below:
Public async void PrintTest(string text)
{
var isConnected= await RefreshPairedDevicesList()
if (isConnected)
{
try
{
if (_socket != null)
{
DataWriter writer = new DataWriter(_socket.OutputStream);
writer.WriteString(text);
writer.WriteBytes(Cmd_ESC_JN); // byte[] Cmd_ESC_JN = new byte[] { 27, 74, 230 };
writer.StoreAsync();
}
}
catch { }
}
}
public async Task<bool> RefreshPairedDevicesList()
{
try
{
PeerFinder.AlternateIdentities["Bluetooth:Paired"] = "";
var peers = await PeerFinder.FindAllPeersAsync();
if (peers == null && peers.Count == 0)
{
MessageBox.Show("NoPairedDevices");
return false;
}
else
{
// Found paired devices.
foreach (var peer in peers)
{
_pairedDevices.Add(new PairedDeviceInfo(peer));
}
PairedDeviceInfo connectedDeive = _pairedDevices.FirstOrDefault();
var issuccess = await ConnectToDevice(connectedDeive.PeerInfo);
return issuccess;
}
}
catch (Exception ex)
{
if ((uint)ex.HResult == 0x8007048F || (int)ex.HResult == -2147467259)
{
var result = MessageBox.Show(MyStoreWP8AppConstants.Msg_BluetoothOff, "Bluetooth Off", MessageBoxButton.OKCancel);
if (result == MessageBoxResult.OK)
{
ShowBluetoothcControlPanel();
}
return false;
}
else if ((uint)ex.HResult == 0x80070005)
{
MessageBox.Show(MyStoreWP8AppConstants.Msg_MissingCaps);
return false;
}
else
{
MessageBox.Show(ex.Message);
return false;
}
}
}
private async Task<bool> ConnectToDevice(PeerInformation peer)
{
if (_socket != null)
{
_socket.Dispose();
_socket = null;
}
try
{
_socket = new StreamSocket();
string serviceName = peer.ServiceName;
serviceName = String.IsNullOrWhiteSpace(serviceName) ? "1" : serviceName;
await _socket.ConnectAsync(peer.HostName, serviceName);
return true;
}
catch (TaskCanceledException taskEx)
{
return false;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
if (_socket != null)
_socket.Dispose();
_socket = null;
return false;
}
}
Could anyone please help us.
Thanks and Regards,
WinitWindowsTeam.
I Got Error as "An exception of type 'System.ArgumentException' occurred in System.Windows.ni.dll but was not handled in user code"
void Touch_FrameReported(object sender, TouchFrameEventArgs e)
{
int pointsNumber = e.GetTouchPoints(img1).Count; \\ I got the Exception in this Line
TouchPointCollection pointCollection = e.GetTouchPoints(img1);
for (int i = 0; i < pointsNumber; i++)
{
if (pointCollection[i].Action == TouchAction.Down)
{
preXArray[i] = pointCollection[i].Position.X;
preYArray[i] = pointCollection[i].Position.Y;
}
if (pointCollection[i].Action == TouchAction.Move)
{
line = new Line();
line.X1 = preXArray[i];
line.Y1 = preYArray[i];
line.X2 = pointCollection[i].Position.X;
line.Y2 = pointCollection[i].Position.Y;
line.Stroke = new SolidColorBrush(Colors.White);
line.StrokeStartLineCap = PenLineCap.Round;
line.StrokeEndLineCap = PenLineCap.Round;
line.StrokeThickness = 20;
img1.Children.Add(line);
preXArray[i] = pointCollection[i].Position.X;
preYArray[i] = pointCollection[i].Position.Y;
}
}
}
How to Handle This Exception in Windows Phone 8
You need a try catch with catch blocks like this...
try { ... }
catch(System.ArgumentNullException ane) { ... }
catch(System.NotSupportedException nse) { ... }
catch(System.IO.PathTooLongException ple) { ... }
catch(System.IO.SecurityException se) { ... }
catch(System.ArgumentException ae) { ... }
Make sure your 'System.ArgumentException' is your last catch. Use the 4 above if need be, you might not need path handler...
I'm getting the net.rim.device.api.io.ConnectionClosedException from my java code for Blackberry. Highlighted in below code is the line where Exception is raised.
hc = (HttpConnection) Connector.open(url);
hc.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + getBoundaryString());
hc.setRequestMethod(HttpConnection.POST);
hc.setRequestProperty(HttpProtocolConstants.HEADER_ACCEPT_CHARSET,
"ISO-8859-1,utf-8;q=0.7,*;q=0.7");
hc.setRequestProperty(HttpProtocolConstants.HEADER_CONTENT_LENGTH ,Integer.toString(fileBytes.length));
OutputStream dout = hc.openOutputStream();
dout.write(boundaryMessage.getBytes());
dout.write(this.postBytes);
dout.write(endBoundary.getBytes());
dout.close();
int ch;
**is = hc.openInputStream();** //exception raised here
if(hc.getResponseCode()== HttpConnection.HTTP_OK)
{
while ((ch = is.read()) != -1)
{
bos.write(ch);
}
res = bos.toByteArray();
System.out.println("res loaded..");
}
else {
System.out.println("Unexpected response code: " + hc.getResponseCode());
hc.close();
return null;
}
}
catch(IOException e)
{
System.out.println("====IOException : "+e.getMessage()+" Class: "+e.getClass());
}
catch(Exception e1)
{
//e1.printStackTrace();
System.out.println("====Exception : "+e1.getMessage()+" Class: "+e1.getClass());
}
finally
{
try
{
if(bos != null)
bos.close();
if(is != null)
is.close();
if(hc != null)
hc.close();
}
catch(Exception e2)
{
e2.printStackTrace();
System.out.println("====Exception : "+e2.getMessage());
}
}
What should I do to correct this? Can anybody help? Thanks in advance.
A simple function defined in the user-extensions.js :
Selenium.prototype.doGetThis = function(){
var errors = "";
if (browserVersion.isChrome) {
errors = true;
} else {
throw new SeleniumError("TODO: Non-FF browser...");
}
return errors;
}
The Selenium.java file:
String getThis() {
return this.commandProcessor.doCommand("getThis", EMPTY_STRING_ARRAY);
}
Running the test throws a SeleniumException:
CHECKPOINT-FAIL com.thoughtworks.selenium.SeleniumException: this.waitForCondition is not a function
Could this exception be avoided?
Settings:
selenium server 2.0a5
firefox 3.6.11
After I added the ; I still got the same exception.
Selenium.prototype.doGetThis = function(){
var errors = "";
if (browserVersion.isChrome) {
errors = true;
} else {
throw new SeleniumError("TODO: Non-FF browser...");
}
return errors;
};
It seems that you need to add a ; to the end of your doGetThis function:
Selenium.prototype.doGetThis = function(){
var errors = "";
if (browserVersion.isChrome) {
errors = true;
} else {
throw new SeleniumError("TODO: Non-FF browser...");
}
return errors;
};